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
How to get the exit satus of a command which I executed in sftp prompt Karteek Shell Programming and Scripting 2 04-09-2008 05:00 AM
exit status of command in a pipe line topcat8 UNIX for Dummies Questions & Answers 10 10-19-2007 01:39 AM
Getting the exit status of a remote command zoonalex Shell Programming and Scripting 1 08-23-2006 01:58 PM
Incorrect Exit Status Returned from FTP command - Help?? frustrated1 Shell Programming and Scripting 3 08-22-2003 12:25 AM
How to find the exit status of last command in Unix? rajugp1 High Level Programming 1 09-10-2002 08:52 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 07-04-2006
Registered User
 

Join Date: Jul 2006
Posts: 2
how to find the exit status for the last executed command

I am executing a find command in my script i.e

find $2 -type f -name '*.gif' -mtime +$1 -exec rm {} \;

how do i check that this command is executed properly.. i would lke t trap the errror and display my error message

kinly help.. this is an urgent issue.
Reply With Quote
Forum Sponsor
  #2  
Old 07-04-2006
dsbeerf's Avatar
Registered User
 

Join Date: Dec 2005
Location: Chicago, IL USA
Posts: 58
Quote:
Originally Posted by vijay.amirthraj
I am executing a find command in my script i.e

find $2 -type f -name '*.gif' -mtime +$1 -exec rm {} \;

how do i check that this command is executed properly.. i would lke t trap the errror and display my error message

kinly help.. this is an urgent issue.
This depends on the shell you are using.

Shells that behave like the C-Shell use the variable: $status
Shells that behave like the Bourne (or Korn) shell use the variable: $?

These variables are set to the exit code of the last command executed.

BEWARE: in a "pipeline", the variable contains the exit code of the LAST command in the pipeline. All the other exit codes are lost.
==
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 03:47 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0