![]() |
|
|
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 |
| grep for pattern | aemunathan | Shell Programming and Scripting | 12 | 05-09-2008 03:58 AM |
| How to grep this pattern?? | askumarece | Shell Programming and Scripting | 13 | 02-20-2008 07:03 AM |
| help with grep the pattern | bluemoon1 | Shell Programming and Scripting | 2 | 09-20-2007 12:27 PM |
| Appending to filename a string of text grep finds | HLee1981 | Shell Programming and Scripting | 3 | 09-06-2005 03:44 PM |
| grep error message | gammaman | UNIX for Dummies Questions & Answers | 3 | 07-11-2005 12:58 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
fixing the error message when grep doesn't finds the pattern.
Hi,
I am running the below script. --------------------------------------------------------- #!/bin/ksh for tname in `cat tables.txt | cut -f 1` ; do if (test -n `grep -il "$tname" /fs/scripts/*`) then echo ${tname} >> UsedTables.txt else echo ${tname} >> UnUsedTables.txt fi done --------------------------------------------------------- Its running fine if grep finds the pattern but when the pattern is not found its giving the following error message: script1.ksh[5]: test: argument expected Eventhough it throws the message but its appending the ${tname} value in the files. Can anyone let me know how to avoid the error message when grep doesn't finds the pattern. Thanks. |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|