[Pkg-sysvinit-devel] Re: Fixing hwclock.sh
Miquel van Smoorenburg
miquels at cistron.nl
Fri Jan 6 15:21:54 UTC 2006
On Fri, 2006-01-06 at 15:39 +0100, Thomas Hood wrote:
> Henrique de Moraes Holschuh wrote, in part:
> > any sourced scripts needing to set variables might well
> > need to start subshells, or play "restore on exit" games, which are a sad
> > thing to have everywhere.
>
>
> Yes.
>
> If any script would have to create a subshell in order to protect the sourcer's
> environment then it shouldn't be a .sh script.
Ehm, well:
case "$i" in
*.sh)
# Source shell script for speed.
(
trap - INT QUIT TSTP
set start
. $i
)
;;
.. *.sh script are already sourced in a subshell.
"exit" is survived:
$ ash -c '( exit 1 ); echo bar'
bar
.. and so is "set -e":
$ ash -c '( set -e; skjdhkshds; echo foo ); echo bar'
ash: skjdhkshds: not found
bar
Mike.
More information about the Pkg-sysvinit-devel
mailing list