From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17175 invoked by alias); 5 Feb 2015 16:46:36 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 19824 Received: (qmail 17682 invoked from network); 5 Feb 2015 16:46:23 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,T_FSL_HELO_BARE_IP_2 autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1423154316; bh=1z/GZw+w9xLqsXiJk/G6oCyj9OBxOTSkVrajTw6YpfE=; h=From:To:In-Reply-To:References:Subject:Date; b=ei0JqYGHVt0h8y1uXnXytpbKXeoxMoga3TiiMxcwjLPOIzVgBpnc9HSXUQgXTJF57 Zh3lIgIogoH4WN6+OBGOu23aM5EmQ+m9eoBM91xlexekj2KHEubgfsGlb1eiq8WkBN Zl9jbD+ZQFGCG75sZ7L95l9vS84KZxOQEc6oXFXo= From: ZyX To: Koch , "zsh-users@zsh.org" In-Reply-To: <54D39290.9020702@gmail.com> References: <54D39290.9020702@gmail.com> Subject: Re: PATH variable case-insensitive? MIME-Version: 1.0 Message-Id: <4875411423154316@web22m.yandex.ru> X-Mailer: Yamail [ http://yandex.ru ] 5.0 Date: Thu, 05 Feb 2015 19:38:36 +0300 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=utf-8 05.02.2015, 19:10, "Koch" : > Using zsh 5.0.2 (x86_64-pc-linux-gnu) with the following file contents in > ./test.zsh: > > PATH=bar > path=omg > echo $PATH > > and running zsh ./test.zsh outputs: > omg > > Is this a bug? It's certainly not my intention to have this meaning attached to > this program, since it goes against POSIX. If you want POSIX emulation in zsh, do use either `emulate -L sh` at the top of the script or run it with symlink named sh (i.e. rather use `sh` as the last component of the program name*)`. Strict POSIX compatibility was never a goal of zsh in its “native” mode. For interactive uses this feature is rather convenient. In scripts I myself have run several times into the effective inability to use `path` variable in e.g. `for path in foo/*` until learned this thing though. * Like this with execve, see the beginning of execve argument: % echo 'int main(int argc, char **argv, char **environ) { execve("/bin/zsh", (const char *[]) {"/bin/sh", "-c", "echo path:$path PATH:$PATH", 0}, environ); }' | tcc -run - path: PATH:/bin:/usr/bin:/usr/ucb:/usr/local/bin % echo 'int main(int argc, char **argv, char **environ) { execve("/bin/zsh", (const char *[]) {"/bin/zsh", "-c", "echo path:$path PATH:$PATH", 0}, environ); }' | tcc -run path:/bin /usr/bin /usr/ucb /usr/local/bin PATH:/bin:/usr/bin:/usr/ucb:/usr/local/bin (It actually appears that tcc does not support 3-argument form of main() (this is not my actual $PATH setting). But the point can be seen in any case since shell is able to get $PATH setting somewhere. Use `gcc -xc - && ./a.out && rm ./a.out` in place of `tcc -run -` to see your actual $PATH setting.)