bin/run-with-shell-env: Preserve the original argument list.
authorMark Wooding <mdw@distorted.org.uk>
Thu, 14 May 2020 13:48:37 +0000 (14:48 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Thu, 14 May 2020 13:48:37 +0000 (14:48 +0100)
The `profile' script makes use of `set', which trashes the argument
list.  Capture it in a shell array at the start (because we're using
Bash here) and then run the target program from the array.

bin/run-with-shell-env

index ba0afcf..00181e3 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/bash -x
 exec >/tmp/mdw/hacky.log 2>&1
+declare -a original_args=("$@")
 case ${__mdw_profile+t} in
   t) ;;
   *)
@@ -10,4 +11,4 @@ case ${__mdw_profile+t} in
     set -x
     ;;
 esac
-exec "$@"
+exec "${original_args[@]}"