[Top][All Lists]

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

Re: init.sh changes pushed

From: Eric Blake
Subject: Re: init.sh changes pushed
Date: Tue, 16 Feb 2010 06:22:06 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20090812 Thunderbird/ Mnenhy/

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
$ chmod +x ./f1
$ ./f1
$ bash ./f1
$ zsh ./f1
$ ln -s `which zsh` sh
$ ./sh ./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             address@hidden

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]