[ubuntu-za] Script error
Russell Cloran
russell at rucus.net
Tue Apr 14 13:42:54 BST 2009
Hi,
On Tue, Apr 14, 2009 at 2:40 PM, Alf Stockton <alf at stockton.co.za> wrote:
>> When you have a * on a commandline, the shell replaces it with all the
>> files that match that pattern.
>> This happens before the 'if' statement is evaluated. And, of course,
>> the "-f" test does not take more than one filename as an argument,
>> which is why you're getting the "too many arguments" error.
> Then I am certainly confused as the following works fine in another script.
>
> if [ -f /mnt/backup/mailbackups/*.dotproject.backup.sql ]
> then
> rm /mnt/backup/mailbackups/*.dotproject.backup.sql
> fi
I would imagine that this other script has never been unlucky enough
to encounter the situation where more than one file matches the glob
you're using.
Russell
--
echo http://russell.rucus.net/spam/ | sed 's,t/.*,t,;P;s,.*//,,;s,\.,@,;'
More information about the ubuntu-za
mailing list