According to Jim Meyering on 2/16/2010 6:07 AM: >>> + *) feb_file_=$(echo $feb_file_ | sed "s,^$feb_dir_/,,;"'s/\.exe$//') >> >> How do we go about fixing this? Should init.sh be given some smarts (like >> autoconf-generated files) to re-exec the calling script using a saner >> shell? > > I like this idea. > Encapsulating the smarts in the test framework itself > would be more maintainable/reusable than what coreutils does.
Next question - how to learn the running script. $ echo 'echo $0' > f2 $ cat <<\EOF > f1 > #!/bin/sh > echo $0 > . ./f2 > EOF $ chmod +x ./f1 $ ./f1 ./f1 ./f1 $ bash ./f1 ./f1 ./f1 $ zsh ./f1 ./f1 ./f2 $ ln -s `which zsh` sh $ ./sh ./f1 ./f1 ./f1 Good: bash, dash, Solaris /bin/sh, and ksh all appear to preserve $0 into a sourced script. Meanwhile, zsh botches things when invoked as zsh, but works when invoked as sh. Since all of our test scripts use #!/bin/sh, if the script was truly started via the she-bang, we should be fine even if zsh is /bin/sh. Any counter-examples out there of some other shell that fails to print "./f1" on the second line using this example? -- Don't work too hard, make some time for fun as well! Eric Blake e...@byu.net
signature.asc
Description: OpenPGP digital signature