tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/48843: sh(1): break/continue/return broken inside dot commands



On Sun, Jun 01, 2014 at 02:09:41AM +0300, Jarmo Jaakkola wrote:
 > How the function call worked was one more reason I chose to implement
 > the dot command fix as I did: one could think this implementation of
 > a dot command as a function call that has no parameters (except "set --")
 > and that the function's body is stored in a file.

Well... implementations other than netbsd's sh seem to allow passing
parameters to a dot command:

valkyrie% cat y2
. ./y a b c d e
valkyrie% cat y
echo '$0 is '"$0"'; $@ is '"$@"
valkyrie% sh ./y2
$0 is ./y2; $@ is 
valkyrie% ksh ./y2
$0 is ./y2; $@ is a b c d e
valkyrie% bash ./y2
$0 is ./y2; $@ is a b c d e
valkyrie% zsh ./y2
$0 is ./y; $@ is a b c d e
valkyrie% 

although apparently only zsh changes $0.

-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index