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
bc, it may be faster to just do everything serially in a language with proper floating-point support.echo "react..."). Is there no way to get this done? Do I need to put the parallel stuff in an extra shell script?LIMIT=25further down by 2 lines, maybe?