22 Apr
2008
22 Apr
'08
15:33
Dirk Moolman wrote:
I have a script that counts the number of files in a certain directory. The command I use is:
NUMFILES=`ls mhc_er* | wc -l`
Maybe you meant "ls -l mhc_er* | wc -l" ?
When there are no files, the script returns the message:
/bin/ls: bar*: No such file or directory
I tried adding 2>/dev/null, but I still get the message. The syntax I used was:
NUMFILES=`ls mhc_er* | wc -l` 2>/dev/null
Try this: NUMFILES=`ls -l mhc_er* 2>/dev/null | wc -l` /Per Jessen, Zürich -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org