[ubuntu-za] Script error
russell at rucus.net
Tue Apr 14 13:42:54 BST 2009
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 ]
> rm /mnt/backup/mailbackups/*.dotproject.backup.sql
I would imagine that this other script has never been unlucky enough
to encounter the situation where more than one file matches the glob
echo http://russell.rucus.net/spam/ | sed 's,t/.*,t,;P;s,.*//,,;s,\.,@,;'
More information about the ubuntu-za