![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| 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 |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
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. |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
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. |
||||
| Google The UNIX and Linux Forums |