![]() |
|
|
|
|
|||||||
| 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 |
| Error message while executing the shell script | ajayyaduwanshi | Shell Programming and Scripting | 4 | 10-25-2007 04:12 AM |
| Suppress error message in unzip | skwyer | Shell Programming and Scripting | 5 | 09-26-2007 02:20 PM |
| How to suppress error messages in script | helper2007 | Shell Programming and Scripting | 5 | 01-17-2007 01:46 AM |
| suppress bash's "Done" message | momiji | Shell Programming and Scripting | 5 | 08-31-2006 07:45 PM |
| problem with script and syntax error message | ReV | Shell Programming and Scripting | 5 | 01-20-2006 03:50 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Suppress error message in shell script
Hi All
this is a simple script #! /bin/bash FileCnt=`ls -lrt $DIR/* | wc -l` echo $FileCnt how could i escape the error msg if there are no files in $DIR ls: /home/sayantan/test/files/cnt/*: No such file or directory 0 Looking forward for a quick reply Regards, Newbie Happy New Year |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Use this:
Code:
FileCnt=`ls -lrt $DIR/* 2>/dev/null| wc -l` |
|
#3
|
|||
|
|||
|
Code:
ls -lrt $DIR/* 2> /dev/null | wc -l` |
|
#4
|
|||
|
|||
|
Thanks a lot
|
|||
| Google The UNIX and Linux Forums |