Sunday, 15 April 2012

bash - background bashscript in if conditional -



bash - background bashscript in if conditional -

i'm calling bash script in if conditionals

in "${array[@]}"; if ! ./script2.sh $i ; break ; fi done

it works fine, if phone call script background process next variations, syntax error:

in "${array[@]}"; if ! ./script2.sh $i & ; break ; fi done in "${array[@]}"; if [ ! ./script2.sh $i & ]; break ; fi done

what's right way it?

you save output in temporary variable , check instead.

for in "${array[@]}"; tmp=$(./script2.sh $i $) if [ ! $tmp ]; break ; fi done

bash

No comments:

Post a Comment