The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to find a file named vijay in a directory using find command amirthraj_12 UNIX for Dummies Questions & Answers 6 3 Weeks Ago 09:37 AM
Perl Script Error with find command MKNENI Shell Programming and Scripting 4 03-26-2008 09:02 AM
list the file created before 24 hours using ls command jayaramanit Shell Programming and Scripting 7 09-11-2007 05:46 AM
Need to find created date of file in UNIX amirthraj_12 Shell Programming and Scripting 7 07-06-2006 11:44 PM
find command exec error pavan_test UNIX for Dummies Questions & Answers 2 06-13-2006 12:58 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 10-21-2005
Registered User
 

Join Date: Sep 2005
Posts: 22
Red face I want to get the file which created the error when the find command was run

I want to get the file which created the error when the find command was run ?

I am wrote a script to mail a list of files whose file size is ge than 0 and returns 0
but wen it finds a folder with only empty files it exits as 1. i need to modify it so that the return for this is also 0 (but it shoudn't mail.)



currently : for empty files it returns 1 and working fine
Please suggest me the changes i can do on it !!

my script :- (it is a gereric code !!)
find $1 \( -type f -size +0c \) | xargs tar cvf $NAME 2> /dev/null

Last edited by guhas; 11-23-2005 at 05:04 AM.
Reply With Quote
Forum Sponsor
  #2  
Old 10-21-2005
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,611
What OS are you using? And what shell? This line scares me:
find $1 \( -type f -size +0c \) | xargs tar cvf $NAME 2> /dev/null

Remember that xargs only collects enough filenames to file a command line, then it repeats. If you have a lot of files, or files with very long names, you may get several separate runs of tar.

If there are no files, tar should complain and exit with a code of 1. You save the code in ERR_HAN. Then you test it. If the code is non-zero, you explicitly do "exit 1". Is this your complaint? Just don't do that.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 06:01 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