Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [ -f glob ]

Atom Smasher wrote:
> On Wed, 9 Jan 2008, Peter Stephenson wrote:
> > This is broken: -f expectes exactly one argument and you're giving it an 
> > expression that expands to multiple arguments.
> ================
> but, why would it work on bsd and not work on solaris?

You're into implementation-specific land, from whose Bourne shell no
traveller returns.

Schematically, you've got something like

[ -f file1 file2 file3 ]

(number not that important).  The "-f file1" is a valid test.  At the
file2 I would expect the test implementation simply to give up and
return an error, but there is so much hackery to get round the fact that
keywords in the test aren't syntactically marked and that the default
test is for a non-empty string even, in some cases, if the string looks
like a keyword that I don't think it's worth worrying about, just
noting that "[" and "test" mean trouble.

Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070

Messages sorted by: Reverse Date, Date, Thread, Author