I want to run a batch process in parallel. For this I pipe a list to parallel
. When I've an if-statement, that compares two floating point numbers (taken form here), the code doesn't run anymore. How can this be solved.
LIMIT=25
ps | parallel -j2 '
echo "Do stuff for {} to determine NUM"
NUM=33.3333 # set to demonstrate
if (( $(echo "$NUM > $LIMIT" | bc -l) )); then
echo "react..."
fi
echo "Do stuff..."
'
Prints:
Do stuff for \ \ PID\ TTY\ \ \ \ \ \ \ \ \ \ TIME\ CMD to determine NUM
Do stuff...
(standard_in) 2: syntax error
#... snipp