bash - How to run sctipt b based on script a result -
i've got 2 working sctipts: a.sh, b.sh.
i create 1 script following: 1. run a.sh 2. running b.sh dependant on output of a.sh wait string a.sh standatd output saying 'a.sh launched' run b.sh if trickyto implement perhaps wait 2 minutes before running second script.
what best way acheiving this?
continuously reads output of a.sh
, when encounters "a.sh launched" launches b.sh
.
./a.sh | while read line; echo $line # if want see output of a.sh [ "$line" == "a.sh launched" ] && ./b.sh & done
if want match
a.sh lounched @ `date`
use advanced bash comparsion
[[ "$line" =~ "a.sh lounched".* ]]
Comments
Post a Comment