bash command grouping for test results in function
问题 I am accustomed to testing that a variable has a non-null value (or give a message and bail) using a line like this: test $variable || (echo "Value of \$variable cannot be null."; exit 1) I'm quite new to using functions in my scripts, but I've got a case where I need to be sure a non-null value is passed or bail out of the function. However the command grouping for the "or" case is not working the same way inside the function. I wrote this little test script to demonstrate: $ cat -n bubu.sh