Date: Sat, 17 Apr 2004 13:22:04 -0500 From: Vincent Stemen <bsd@hightek.org> To: freebsd-bugs@FreeBSD.ORG Subject: /bin/sh bug Message-ID: <20040417182204.GA26559@quark.hightek.org>
next in thread | raw e-mail | index | archive | help
Another sh bug I think. If you dot in a file from a script, $1 in the child script inherits it's value from the parent and the arguments do not get passed. This is on FreeBSD-5.1-RELEASE on the i386 platform. The following examples compare the behavior to bash and zsh. Zsh has the most appropriate bahavior as it also properly sets $0. $ cat test1 echo "$0: \$1 = [$1]" . ./test2 test2arg $ cat test2 echo "$0: \$1 = [$1]" $ sh ./test1 foo ./test1: $1 = [foo] ./test1: $1 = [foo] $ bash ./test1 foo ./test1: $1 = [foo] ./test1: $1 = [test2arg] $ zsh ./test1 foo ./test1: $1 = [foo] ./test2: $1 = [test2arg] -- Vincent Stemen Avoid the VeriSign/Network Solutions domain registration trap! http://www.InetAddresses.net
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040417182204.GA26559>