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

Re: About 'test' compatibility



On Tue, 26 Feb 2002, DervishD wrote:

>     I'm trying to use zsh for building the linux kernel, but the
> configuration scripts make use of the '[' builtin, and assume that
> '-a' means 'and', and not 'true if file exists'.

Can you give an example of the way this is failing?

Zsh 'test' does support -a for "and" but only when it appears as an infix
operator, e.g.

	[ foo -a bar ]		is true
	[ foo -a "" ]		is false
	[ "" -a bar ]		is false

	[ -a bar ]		is true if file "bar" exists, else false

My suspicion would be that the kernel build is doing something like

	[ $foo -a $bar ]

which zsh would interpret as infix -a only if $foo were non-empty.  The
correct test would be

	[ "$foo" -a "$bar" ]

and if that is indeed the issue, the kernel build scripts really should be
fixed.



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