Package: debian-reference
Version: 2.50
Severity: normal

This discussion for bug #713885 reminded me to add a short note for zsh
to debian-reference.  (I do not use zsh but ...)

On Thu, Jul 04, 2013 at 05:27:12PM +0200, Thomas Preud'homme wrote:
...
> > I also found zsh behavior odd.
...
> It's not a bug, it's a featureā„¢.
> 
> Zsh has lots of "odd" behavior like this. See for instance:
> 
> # With zsh
> % foo="bar baz"
> % for name in $foo ; do echo "name: $name" ; done
> name: bar baz
> 
> # With bash
> % foo="bar baz"
> $for name in $foo ; do echo "name: $name" ; done
> name: bar
> name: baz
> 
> Although it's disturbing when compared to bash, I find it a better default.
...
> > === ZSH ===
...
> > osamu@goofy ~ % EEE=$(ls /usr/lib/*/gtk-2.0/*/immodules/im-ibus.so
> > /usr/lib/gtk-2.0/*/immodules/im-ibus.so) zsh: no matches found:
> > /usr/lib/gtk-2.0/*/immodules/im-ibus.so
> > osamu@goofy ~ % echo $EEE
...
> > The second path is not expected to match anything.  That is the same in
> > dash or bash.  But, zsh spits some error message to non-stderr and quits.
> > EEE is not set either.
> > 
> > This is strange for me.
> 
> The thing is zsh's behavior is safer by default. In bash, if a *
> doesn't match any file it will be left as is. Thus, if you do touch *
> and there is no file in the current directory, it will create a file
> named '*'. In zsh, the default is to just returns an error. Bash's
> behavior can be obtained by setting NOMATCH.  Alternatively, you can
> set NULL_GLOB to replace '*' by nothing. This is explained in the
> zshexpn man page, in the FILENAME GENERATION section:
> 
> "The word is replaced with a list of sorted filenames that match the pattern. 
> If  no  matching  pattern is found,  the  shell  gives  an  error message, 
> unless the NULL_GLOB option is set, in which case the word is deleted; or 
> unless the NOMATCH option is unset, in which case the word is left unchanged."

Let me add at the end of "1.4.1. The login shell":
  
http://www.debian.org/doc/manuals/debian-reference/ch01.en.html#_the_login_shell

TIP: 
For the login interactive shell, Zsh is a feature rich alternative to
Bash and popular with some power users.  Please note that some features
of Zsh such as shell variable and glob expansions are slightly different
from that of Bash.

Osamu


--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to