On 2013-03-18 14:37, Bastian Bittorf wrote:
* Joshua Judson Rosen<[email protected]> [18.03.2013 19:32]:
[ -e "$file" ]&& . "$file"
not ok for you? my usecase was more a "speed" issue, because
The only technical reason against that is the race condition if $file is
deleted after the existence/read check.
Yes. And there's no way to get around the shell aborting in that case.
maybe something like:
cp "$file" "/tmp/include_$$" || . "/tmp/include_$$"
Actually.... I think I'm having one of those moments where, after getting
everyone else involved in a big discussion, I finally realise that I'm
just dumb--here's the alias that my ksh installation uses to make "source"
do what my shell scripts were expecting (try to do ". $file", and just
return an error but not abort the shell if it doesn't work):
alias source='command .'
Whoa. "command . $file" even appears to work consistently across
ash/dash/busybox/bash/ksh.
Who knew?
--
"Don't be afraid to ask (λf.((λx.xx) (λr.f(rr))))."
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox