Error due exit code 1 in bash command #26662
-
I need to compare some version numbers and I’m using
When the versions are greater of equal to 5.17 is working fine, but when is lower, it returns exit code 1 and the next line (that evaluate $?) is ignored. What is the correct way to evaluate the exit code of one shell command inside “run:”? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
By default the shell in
cgarces:
Put the command directly into the
That way a possible non-zero exit code is handled by the |
Beta Was this translation helpful? Give feedback.
-
Thanks @airtower-luna |
Beta Was this translation helpful? Give feedback.
By default the shell in
run
steps runs withset -e
, so it terminates as soon as any command returns an error (AKA a non-zero exit code).Put the command directly into the
if
condition instead of relying on$?
, like so:That way a possible non-zero exit code is handled by the
if
and doesn’t make the shell exit. 🙂