I have a simple script that I use to keep an application running on a windows machine:
:loop
;// execute a shell command
IF ERRORLEVEL == 1 GOTO loop
pause > nul
The program this is keeping alive I'm wanting to move to an offsite server that is running Linux. Obviously I'll need to convert the script to something bash can understand, but the ERRORLEVEL variable is where I am lost. ERRORLEVEL in Windows is a variable that holds the integer return value of the last command that executed. For any normal program termination that is usually 0. I have this particular program set to return 1 (System.exit(1)) when there is an error. It logs the error on its own and this script restarts the program. Anyone know the linux equivalent?