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

Re: About 'test' compatibility



    Hello Bart :))

    First, thanks for your answer: *real* fast ;))

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

    Yes, this is the line:

	if [ "$DEFAULT" = "-d" -a -n "$3" ]; then
        do something
    else
        do another thing
    fi

    Well, when DEFAULT is '-d' and there is a third parameter (in
this case $3 has the value 'n') the 'something' is not done. The
'another thing' is done instead :??
 
>Zsh 'test' does support -a for "and" but only when it appears as an
>infix operator, e.g.

    Maybe the '-n' following '-a' is confusing zsh?

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

    This is the case. Maybe I'm missing something, I'm afraid.

    Thanks a lot for your answer, Bart.

    Raúl



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