Sample Header Ad - 728x90

Bash complaints about missing ], while it is there

2 votes
2 answers
76 views
I have following in a bash script: echo "status: [$status] and message: [$message]" if [ "${status}" -eq 0 && "$message" = "ERROR" ]; then echo "Exit 0"; exit 0 fi # status: message: [ERROR] However, it gives below error, and the logic under then i.e. exit 0 never gets executed: line 2: [: missing `]' It seems to be complaining about the missing closing ], however, it is there. What am i missing here?
Asked by Nullpointer (199 rep)
Jan 9, 2024, 03:54 PM
Last activity: Jan 9, 2024, 04:09 PM