[ubuntu-za] Script error

Russell Cloran russell at rucus.net
Tue Apr 14 14:37:41 BST 2009


On Tue, Apr 14, 2009 at 3:25 PM, Walter Leibbrandt
<walter+ubuntuza at translate.org.za> wrote:
>> Of course, an asterisk glob which was not expanded means that the file
>> doesn't exist and your -f will be false anyways.

> Hmmm... not according to these:
> $ if [ -f ]; then echo 1; else echo 0; fi
> 1
> $ if [ -f x* ]; then echo 1; else echo 0; fi
> 0

> And yes, there is no x* files. ;) That made me believe that -f always
> returns true for no arguments, even an unexpanded blob (like x*) returns
> false, because the file "x\*" does not exist.
> Or am I missing something?

Sorry, I misread your original post. I don't think that the snippet
posted would work for zero files in existence for the reason you gave,
however. It would work because the file called "x*" doesn't exist.

echo http://russell.rucus.net/spam/ |  sed 's,t/.*,t,;P;s,.*//,,;s,\.,@,;'

More information about the ubuntu-za mailing list