![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 can i put the condition in for loop for the below. | mail2sant | Shell Programming and Scripting | 1 | 04-28-2008 04:49 AM |
| Checking condition inside the loop | ithirak17 | Shell Programming and Scripting | 1 | 03-13-2008 08:37 AM |
| What condition to be put in the while loop? | nehaquick | UNIX for Dummies Questions & Answers | 1 | 02-15-2008 04:06 PM |
| End of loop condition required??? | skyineyes | Shell Programming and Scripting | 4 | 07-16-2007 03:10 AM |
| how to get the similar function in while loop or for loop | trynew | Shell Programming and Scripting | 3 | 06-17-2002 11:09 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Testing For Loop condition
How do I test the return condition in the script if no files are found:
for file in `Find ${LANDING_FILE_DIR}${BTIME_FILENAME_PATTERN}` do ... .. done I want to capture the return code so I can echo the error or condition. Using if [[ $# -eq 0 ]] always returns zero no matter where it's placed. tia |
|
||||
|
I do the following a check for -s and -r. The find statment in the for loop issues a bad status:
find: bad status-- /home/rnitcher/test/BTIME_ACTUAL_WORK_HRS_wk_[0-9][0-9]_to_[0-9][0-9].csv I need to capture this return from the find command and exit the program cleanly. tia |
|
||||
|
yes I think so.
... for file in `find ${LANDING_FILE_DIR}${bTIME_FILENAME_PATTERN1}` do .... running the script I get the following find error: find: bad status-- /.../BTIME_ACTUAL_WORK_HRS_wk_[0-9][0-9]_to_[0-9][0-9].csv so I'm looking for a way in the script to capture the fact that no file(s) where found and not just have the script abort with the the find: bad status message.... tia |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|