[wellylug] bash script help
Mark Signal
mark at remote-assist.co.nz
Thu Jan 27 15:43:54 NZDT 2005
your mod works fine thanks Ewen
(I must have been just plain lucky in the past)
and thanks Andre - I have never played with xargs - looks I need to sit
down when I have a bit of time and learn what makes it tick.
Thanks guys for your help
cheers
Mark
Ewen McNeill wrote:
>In message <41F835F3.3080105 at remote-assist.co.nz>, Mark Signal writes:
>
>
>>#!/bin/bash
>>if [ -f /var/spool/amavis-ng/problems/*.msg ]; then
>>[....]
>>If works fine but if there are to many stuck email messages it gives
>>the following error:
>>
>>./problememail.sh: [: too many arguments
>>
>>presumably the [ -f /var/spool/amavis-ng/problems/*.msg ] causes the
>>problem ?
>>
>>
>
>Yes. When it expands to more than one argument (eg, there are two files
>in the directory) then there are too many arguments for the "-f" test,
>hence the error you get.
>
>You probably want to use something like the return code of ls:
>
>if ls /var/spool/amavis-ng/problems/*.msg >/dev/null 2>&1; then
>
>to test for the presence of files.
>
>Ewen
>
>
>
>
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.7.4 - Release Date: 25/01/2005
More information about the wellylug
mailing list