LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Handling Errors and exceptions of commands (https://www.linuxquestions.org/questions/linux-newbie-8/handling-errors-and-exceptions-of-commands-650584/)

pdklinux79 06-20-2008 01:42 PM

Handling Errors and exceptions of commands
 
I execute a command in bash shell script
eg a server maintenance command:

srmt ... .... ...

how to catch error if this command returns
ERROR:
server_exception(MSG_ERR_RECVFAILED)


i want to be able to catch this error , not print in the console but handle my own way and give an output of my choice

how to do it...

Tinkster 06-20-2008 02:28 PM

By checking its return-value and mapping it to a string?
echo $?
will give you an idea what the code is ...


Cheers,
Tink


All times are GMT -5. The time now is 03:24 PM.