What does `return -1 || output -1` means?

I am confused by the following bash line written by someone else:

return -1 || exit -1

What does it mean? I understand that the construction ||means that the first part (in this case return -1) failed (i.e., returned a non-zero code), then the second part ( exit -1) is executed . The same thing is strange that this statement is not part of any function, but in the main part of the script.

I appreciate someone who explains this to me.

+4
source share
1 answer

Here returnis the exit trick when the script is source-ed and exitusually that it exits the shell.

, , script, source -ed .

, bash. 255, -1. ​​

+4

All Articles