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

Re: Running "unset path" breaks PATH despite emulation being enabled



On Fri, Sep 8, 2017 at 10:29 AM, Eric Pruitt <eric.pruitt@xxxxxxxxx> wrote:
> According and <http://www.zsh.org/mla/users/2015/msg00180.html> and the
> manual, Z shell should become roughly POSIX compatible when using
> "emulate sh". When using emulation, running 'path=""' does not break
> PATH command execution, but running 'unset path' still does which seems
> like a bug to me:
>
>     $ zsh -c 'emulate -L sh; path=""; ls /dev/null'
>     /dev/null
>     $ zsh -c 'emulate -L sh; unset path; ls /dev/null'
>     zsh:1: command not found: ls

This works fine if you start zsh as sh though, ie either make a
symlink ln -s =zsh sh; ./sh or do ARGV0=sh zsh
It can't really work in the 'emulate sh' case since the parameter
$path is then already created and it would be quite controversial for
emulate to remove parameters from the shell environment.

-- 
Mikael Magnusson



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