Is there a functional advantage to using a simple if-then statement such as
if [ … ]; then do
using short circuit list evaluators with commands such as
[ … ] && { }
Of course, if then the standard way of recording, but is there any actual difference / advantage from a functional point of view?
Using () instead of {} will create a new subshell, creating a new scope for variables inside the if-then block.
source share