LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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, 01: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, 02:28 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

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


Cheers,
Tink
 
  


Reply



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 08:10 AM
errors while handling sys_unlink dypgrp Linux - General 0 02-01-2005 09:57 AM
linux file handling errors class_struggle Linux - Newbie 1 07-26-2004 05:31 PM
Need help w/ shell handling 3 commands/2 pipes sptchamp Programming 3 07-15-2004 09:37 PM
Exception handling compilation errors ashwinipahuja Programming 6 07-03-2004 06:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:56 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
Open Source Consulting | Domain Registration