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

Re: /usr/bin/printf



2009/2/13 Matthew Flaschen <matthew.flaschen@xxxxxxxxxx>:
> zsh (zsh 4.3.4 (i686-pc-linux-gnu)) seems to use (probably for
> optimization) its built-in printf even if you explicitly specify
> /usr/bin/printf .  Of course, this is only coming up because zsh's
> printf seems to be wrong (or it least doesn't match the executable it's
> mimicking)
>
> Under bash:
>
> $ printf "%s\n" foo
> foo
>
> Under dash (or bash):
>
> $ /usr/bin/printf "%s\n" foo
> foo
>
> Under zsh:
>
> % printf "%s\n" foo
>
> " foofoo
>
> /usr/bin/printf "%s\n" foo
>
> " foofoo
>
> zsh's printf does some really bizarre things:
>
> % /usr/bin/printf "%s" > /dev/null
> " > /dev/null
>
> It actually prints the text /dev/null !
>
> Under bash:
>
> $ /usr/bin/printf "%s" > /dev/null
> $
>
> Is this a known issue?

This is because your preexec() function is broken and is outputting
the newline from the cmdline without escaping it, which makes your
terminal stop reading the title, and the rest of the command line is
just echoed. This is kind of hard to figure out the first time.

-- 
Mikael Magnusson



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