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

Re: grammar triviality with '&&'



On 03/02/2015 10:52 AM, Kurtis Rader wrote:
Why are you using ancient Bourne-shell syntax? If you need compatibility
with the Bourn-shell you can't use the feature you're asking for. If you
use the slightly less ancient Korn-shell syntax you can break the test
across lines the way you want:

So I see.  Thanks, I didn't know about using [[ that way:

#!/bin/zsh
ozymandia=yes

if [[ -e 'shelly.txt'
    && -n "$ozymandia"
    && -n $(grep "I met a traveler" shelly.txt) ]]
then
     echo "Look on my works, ye mighty"
fi

Note that I fixed your command as "grep" isn't a valid test; although, I
wouldn't write it that way in practice as it isn't efficient.

Doesn't matter, I just made that up. Anyway, it was a theoretical issue gentlemen, I just thought I'd ask, I don't really have any great difficulties using the line continuation. It seems this 'errexit' thing does create a hard syntactic issue so that answers my question.




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