Hi guys im wondering how does || work when declaring variables? You can see this in the 3rd line in the code below. $output is set to a function and then the $error variable is set to the exit code of the previous command after the ||. What does || do in this situation/how is it handled?
if [ "$ENABLED" = "yes" ] || [ "$ENABLED" = "YES" ]; then
log_action_begin_msg "Starting firewall:" "ufw"
output=`ufw_start` || error="$?" <-- HERE
if [ "$error" = "0" ]; then
log_action_cont_msg "Setting kernel variables ($IPT_SYSCTL)"
fi
if [ ! -z "$output" ]; then
echo "$output" | while read line ; do
log_action_cont_msg "$line"
done
fi
else
log_action_begin_msg "Skip starting firewall:" "ufw (not enabled)"
fi