The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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

Closed Thread
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
  #1 (permalink)  
Old 07-04-2006
vijay.amirthraj vijay.amirthraj is offline
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.
  #2 (permalink)  
Old 07-04-2006
dsbeerf's Avatar
dsbeerf dsbeerf is offline
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.
==
Closed Thread

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 04:16 PM.


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