Testing a command's stored exit status with var=$?; [[ $var ]] is always true, whether 0 or 1

前端 未结 2 733
再見小時候
再見小時候 2021-01-16 20:55

Consider:

true; run_backup=$?
if [[ $run_backup ]]; then
  echo \"The user wants to run the backup\"
fi

...and...

false; ru         


        
2条回答
提交回复
热议问题