I'm tring to write down a simple script that would execute a command and wait until it returns a specific result.
This is what i did:
bjobs_out=`bjobs`
while [[ "$bjobs_out" != "No unfinished job found" ]]; do
bjobs_out=`bjobs`
sleep 6
done
It seems to work until the command 'jobs' return the list of jobs in execution, but when there aren't jobs it prints on the screen "No unfinished job found" infinitely!
Is there someone that can help me?
These are the tests i have already did:
while [[ "$bjobs_out" != "No unfinished job found" ]]; do
-> result: as described above
2.
while [[ "$bjobs_out" != "No unfinished job found" ]]; do
-> result: as described above
3.
while "$bjobs_out" != "No unfinished job found"; do
-> result: "command not found"
4.
while $bjobs_out != "No unfinished job found"; do
-> result: "command not found"
5.
while [[ $bjobs_out != "No unfinished job found" ]]; do
-> result: as described above
6.
while (echo $(echo "${bjobs_out}")!="No unfinished job found")
-> result: as described above
7.
while (echo $(echo "${bjobs_out}")!="")
-> result: as described above
8.
while echo $(echo "${bjobs_out}")
-> result: as described above
9.
while echo($(echo "${bjobs_out}"))
-> result: as described above
10.
while ($(echo "${bjobs_out}"))
-> result: as described above
11.
while !($(echo "${bjobs_out}" | grep -q "No unfinished job found"))
-> result: as described above