A lot of sh code looks like:
$cmd if [ $? = 0 ]; then $cmd2; fi
Instead of:
if $cmd; then $cmd2; fi
I have typically assumed that people use the former simply because they are unaware that the syntax of the latter is valid, but I'm wondering if there is another reason (although the only possibility that comes to mind is portability). Is there any reason to prefer explicitly referencing ${?}?.