From cdf62e3be84fbd84f930021795cb3870ae7d8e8a Mon Sep 17 00:00:00 2001 From: deajan Date: Wed, 4 Jan 2017 08:55:04 +0100 Subject: [PATCH] Minor fixes --- dev/ofunctions.sh | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/dev/ofunctions.sh b/dev/ofunctions.sh index 35f4c33..11eaff4 100644 --- a/dev/ofunctions.sh +++ b/dev/ofunctions.sh @@ -3,7 +3,7 @@ #### OFUNCTIONS MINI SUBSET #### _OFUNCTIONS_VERSION=2.1-RC1+dev -_OFUNCTIONS_BUILD=2017010301 +_OFUNCTIONS_BUILD=2017010401 #### _OFUNCTIONS_BOOTSTRAP SUBSET #### _OFUNCTIONS_BOOTSTRAP=true #### _OFUNCTIONS_BOOTSTRAP SUBSET END #### @@ -680,7 +680,7 @@ function WaitForTaskCompletion { Spinner fi if [ $counting == true ]; then - exec_time=$(($SECONDS - $seconds_begin)) + exec_time=$((SECONDS - seconds_begin)) else exec_time=$SECONDS fi @@ -836,7 +836,7 @@ function ParallelExec { fi if [ $counting == true ]; then - exec_time=$(($SECONDS - $seconds_begin)) + exec_time=$((SECONDS - seconds_begin)) else exec_time=$SECONDS fi @@ -874,7 +874,7 @@ function ParallelExec { fi eval "HARD_MAX_EXEC_TIME_REACHED_$callerName=true" # Return the number of commands that haven't run / finished run - return $(($commandCount - $counter + ${#pidsArray[@]})) + return $((commandCount - counter + ${#pidsArray[@]})) fi while [ $counter -lt "$commandCount" ] && [ ${#pidsArray[@]} -lt $numberOfProcesses ]; do @@ -897,7 +897,6 @@ function ParallelExec { if [ $(IsInteger $pid) -eq 1 ]; then # Handle uninterruptible sleep state or zombies by ommiting them from running process array (How to kill that is already dead ? :) if kill -0 $pid > /dev/null 2>&1; then - #pidState=$(ps -p$pid -o state= 2 > /dev/null) pidState="$(eval $PROCESS_STATE_CMD)" if [ "$pidState" != "D" ] && [ "$pidState" != "Z" ]; then newPidsArray+=($pid) @@ -937,11 +936,6 @@ function CleanUp { fi } -# obsolete, use StripQuotes -function SedStripQuotes { - echo $(echo $1 | sed "s/^\([\"']\)\(.*\)\1\$/\2/g") -} - # Usage: var=$(StripSingleQuotes "$var") function StripSingleQuotes { local string="${1}" @@ -1423,8 +1417,8 @@ function __CheckArguments { if [ "$argument" == "" ]; then fetchArguments=false else - argList="$argList[Argument $(($iterate-2)): $argument] " - iterate=$(($iterate+1)) + argList="$argList[Argument $((iterate-2)): $argument] " + iterate=$((iterate+1)) fi done @@ -1440,7 +1434,7 @@ function __CheckArguments { Logger "Entering function [$callerName]." "PARANOIA_DEBUG" if ! ([ $countedArguments -ge $minArgs ] && [ $countedArguments -le $maxArgs ]); then - Logger "Function $functionName may have inconsistent number of arguments. Expected min: $minArgs, max: $maxArgs, count: $countedArguments, bash seen: $numberOfGivenArguments. see log file." "ERROR" + Logger "Function $callerName may have inconsistent number of arguments. Expected min: $minArgs, max: $maxArgs, count: $countedArguments, bash seen: $numberOfGivenArguments." "ERROR" Logger "$callerName arguments: $argList" "ERROR" else if [ ! -z "$argList" ]; then