diff options
Diffstat (limited to 'bin/with_env')
-rwxr-xr-x | bin/with_env | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/bin/with_env b/bin/with_env new file mode 100755 index 00000000000..e678fa2f0cc --- /dev/null +++ b/bin/with_env @@ -0,0 +1,16 @@ +#!/bin/sh +# Usage: with_env ENV_FILE COMMAND [ARGS...] +# +# This script lets you modify the environment of an executable before +# launching it. It uses an 'env file' which must contain lines like +# 'MY_VARIABLE="my value"'. +# +env_file=$1 +shift + +# Use set -a to export all variables defined in env_file. +set -a +. "${env_file}" +set +a + +exec "$@" |