Is there a reason to quote the exit status $? variable?

Highly recommend

You should read this wonderful answer for more details.


Setting IFS contains digit can break your code:

$ IFS=0
$ echo test
$ [ $? -eq 0 ] && echo done
bash: [: : integer expression expected

Some shells may inherit IFS from environment (dash, ash), some don't (bash, zsh, ksh). But someone can control the environment, your script will break anyway ($#, $! are also affected).

A note, in your example, you used new test [[...]], so field splitting is turned off, you don't need to quote in this case. It will be matter if you use old test [...].

$ IFS=0
$ echo test
$ [[ $? -eq 0 ]] && echo done
done

Technically, you don't need to quote the left-hand side within [[ ... ]]. But as Stéphane Chazelas put it in comments on his beautiful answer, there's no compelling reason not to quote it, so just do it and sleep better at night. It's a good recommended practice, less doubts and questions asked.

In old-style [ ... ] you must quote, you don't have a choice. In any case you shouldn't use old-style [ ... ] anymore, the new style [[ ... ]] is the recommended way.