The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
/var/adm/messages error sunsri01 SUN Solaris 2 11-09-2007 11:33 AM
ftp error messages! dineshr85 Shell Programming and Scripting 1 10-19-2007 02:03 AM
error messages murad.jaber SUN Solaris 0 10-11-2007 03:02 AM
error messages in /var/adm/messages nitinp82 UNIX for Advanced & Expert Users 1 04-17-2007 11:17 AM
error in /var/adm/messages julie UNIX for Dummies Questions & Answers 2 08-08-2001 05:10 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 10-26-2005
akrathi akrathi is offline
Registered User
  
 

Join Date: Sep 2005
Posts: 41
Error Messages

I have got script like this
#!/bin/ksh -e
function errtrap {
es=$?
print "ERROR line $1: Command exited with status $es."
}
trap 'errtrap $LINENO' ERR

cp no_perm yes_perm
echo "error"

When I run the script I get a output like this.
**********************
cp: cannot access no_perm
ERROR line 7: Command exited with status 2.
***********************

I would like to catch the error message " cp: cannot access no_perm " and display that with the print statement rather send in a mail at that place .
Is there any variable like $? which catches a error message . Much like sqlerrm variable in oracle .

I have done man ksh and did not find any .

I am doing this in script so that I don't have a option like
cp no_perm yes_perm 2>file
and then grep the content of file . Again for some reason i can't do call a script like test.ksh 2>/dev/null

Thanks
Ashok
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:06 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0