Ok, testing if I'm reading this right and if I, an idiot when it comes to TeX can see a better way to do this then whomever wrote the origional since I'm that annoyed:
Would this, in theory at least, work?
\ExecuteOptions{shell}
\newif\ifcmd
\newif\ifnix
\ProcessOptions\relax
%% test if shell escape really works
\ifShellEscape
\def\tmpfile{w18-test-\the\year\the\month\the\day\the\time.tex}
\immediate\write18{echo t > "\tmpfile"}
\IfFileExists{\tmpfile}{\ifcmdtrue}{\ifcmdfalse}
\ifcmpd
\else
\immediate\write18{touch \tmpfile}