LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 06-20-2008, 02:42 PM   #1
pdklinux79
LQ Newbie
 
Registered: Jun 2008
Posts: 29

Rep: Reputation: 15
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...
 
Old 06-20-2008, 03:28 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,005
Blog Entries: 11

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


Cheers,
Tink
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
YUM/RPM commands giving errors MontyPY Linux - Software 1 03-04-2005 09:10 AM
errors while handling sys_unlink dypgrp Linux - General 0 02-01-2005 10:57 AM
linux file handling errors class_struggle Linux - Newbie 1 07-26-2004 06:31 PM
Need help w/ shell handling 3 commands/2 pipes sptchamp Programming 3 07-15-2004 10:37 PM
Exception handling compilation errors ashwinipahuja Programming 6 07-03-2004 07:46 AM


All times are GMT -5. The time now is 08:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration