I need to understand this command:
[ $? == 1 ] && return 0
$? evaluates to the exit code of the previous command.
&& is a command separator which will run the second command if and only if the first command returns an exit code of zero.
test is a shell tool to make various comparative tests.
I should point out that
== is the wrong test to use here as that is for string comparison;
-eq is the equality test for numerical comparison.
[ $? -eq 1 ] && return 0 will look at the exit code of the immediately previous command, and compare it to
1. If there is a match, the command
return 0 will be executed (thereby bypassing what I presume to be subsequent commands in the function wherein this test lies).
The distinction between the usage of
-eq is that
[ 01 -eq 1 ] is true whilst
[ 01 == 1 ] is false.