bash - background bashscript in if conditional -
i'm calling bash script in if conditionals
in "${array[@]}"; if ! ./script2.sh $i ; break ; fi doneit 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 donewhat'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