Alexandre Oliva <[EMAIL PROTECTED]> wrote:
| On Mar 17, 2001, Jim Meyering <[EMAIL PROTECTED]> wrote:
|
| > * missing (--run): Use `eval' to run `"$@"'. Otherwise, Ultrix4.4's
| > /bin/sh fails and outputs garbage.
|
| Won't this evaluate the arguments one too many times?
Thanks! You're right.
| How about:
|
| prog=$1
| shift
| $prog ${1+"$@"} && exit 0
But wouldn't that'd have the same problem, in the unlikely event
that $1 contains shell meta-characters. How about this instead?
Index: missing
===================================================================
RCS file: /cvs/automake/automake/missing,v
retrieving revision 1.12
diff -u -p -r1.12 missing
--- missing 2000/10/16 09:01:36 1.12
+++ missing 2001/03/19 08:54:35
@@ -30,7 +30,16 @@ case "$1" in
# Try to run requested program, and just exit if it succeeds.
run=
shift
- "$@" && exit 0
+ # This is convoluted because using `"$@" && exit 0' doesn't
+ # work with some shells (at least Ultrix4.4's /bin/sh).
+ case "$@" in
+ :)
+ : && exit 0
+ ;;
+ *)
+ ( exec "$@" ) && exit 0
+ ;;
+ esac
;;
esac