0

I am running the below script :

status="UNKNOWN"
while [[ "$status" != "OUTPUT"]]; do
    echo "Checking
    status of job $jobid" status=$(zowe zos-jobs view job-status-by-jobid "$jobid" --rff status --rft string)
    echo "Current status is $status"
    sleep 5s
done;

all the time I am getting errors like : syntax error in conditional expression: unexpected token `;'

I tried allot of combinations to solve this issue but every time I am getting different error .

PS : I am running on PowerShell of windows

  • Add a space before the closing ]] (and maybe after). – danzel Feb 20 at 8:09
1

When I am writing bash scripts I use shellcheck to check, if there are any syntax errors etc. You can either install it via apt-get install shellcheck or you use the shellcheck website.

I pasted your script there and it gives following output:

Line 2:
while [[ "$status" != "OUTPUT"]]; do
^-- SC1009: The mentioned syntax error was in this while loop.
      ^-- SC1073: Couldn't parse this test expression. Fix to allow more checks.
                                ^-- SC1020: You need a space before the ]].
                                ^-- SC1072: Missing space before ]. Fix any mentioned problems and try again.

Try to fix the mentioned stuff from the output.

| improve this answer | |
  • Thank you , I resolved this :status="UNKNOWN" while [ "$status" != "OUTPUT" ]; do echo "Checking status of job $jobid" status=$(zowe zos-jobs view job-status-by-jobid "$jobid" --rff status --rft string) echo "Current status is $status" sleep 10s done – ehab Feb 20 at 8:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.