Question on command

Hi,

can you please tell me what is the purpose of the following line:

sh -c /home/dir/script.sh || exit 33

what i am confused is the || is this an OR boolean, or it might have some other purpose.
do you know how this works ?
i believe the first to run is the /home/dir/script.sh but what throws me off is the exit 33 with ||

thank you,
./antonio/.

It runs script.sh and if it returns an exit code other than 0, it is "false" and so the "or" which is represented as || will exit the shell with the return code 33.

1 Like

thank you zaxxon for the quick help. appreciated.

./antonio/.

|| is a short-form else. If the previous command fails, run the next. && is the opposite, if the previous command succeeds, run the next.

Try these:

true && echo "This should print"
false && echo "This should not"
true || echo "This shouldn't print"
false || echo "But this will"

corona,

thank you for the help and code,

./antonio/.