13

Shell command execution always giving zero as return value

view full story
linux-howto

http://www.unix.com – Whenever the shell script is invoked by the scheduler the command execution return code is always captured as 0(Success). If the same shell script is executed in command line via unix terminal, the command execution return code's are captured properly. For example: ls -ltr es_wrong_file ----> file not available in the filesystem echo $? ----> return code $? will be 2(other than 0) If the above example is executed via scheduler (which in turn invokes the script) - the return code is captured as 0 (success) whereas if its a directly command line execution of the same script then the r (HowTos)