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

Weird behavior of conditionals with exclamations (ZSH 5.0.7)



I've recently encountered a bug in Fedora 22 where I get error
messages when browsing a folder that contains exclamation signs in
it's name in GNOME Terminal with ZSH.

I tracked it down to a profile.d script shipped by the VTE terminal
emulation library. The __vte_urlencode function triggers a "too many
arguments" error in the case I mentioned. You can see the code at the
GNOME miirror in Github [1].

The error happens at line 31:

while [ -n "$str" ]; do

If and only if the value of "$str" is '!', a string containing a
single exclamation. It seems the test command somehow attempts to
parse it as a modifier, instead of an actual string to be tested. The
same *does not* happen in Bash. It seems incorrect, or at least
strange, to me.

Somehow using [[ ]] works correctly. I don't know why that is the case.

Is that expected or have I ran into an issue?

Thanks,
Daniel

[1] https://github.com/GNOME/vte/blob/master/src/vte.sh#L26



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