accessing ERRORLEVEL from bash script
Yes, $?
is the variable that contains the error level.
Try echo $?
for example.
An example from Cygwin bash (I'm guessing you are using Cygwin because you are using the Windows cmd
in your example.)
susam@nifty /cygdrive/c/Documents and Settings/susam/Desktop
$ cmd /c "badapp"
'badapp' is not recognized as an internal or external command,
operable program or batch file.
susam@nifty/cygdrive/c/Documents and Settings/susam/Desktop
$ if [ $? -eq 0 ]
> then
> echo "good"
> else
> echo "bad"
> fi
bad