diff options
Diffstat (limited to 'util')
-rw-r--r-- | util/README.markdown | 27 | ||||
-rwxr-xr-x | util/bin/with | 6 |
2 files changed, 33 insertions, 0 deletions
diff --git a/util/README.markdown b/util/README.markdown new file mode 100644 index 00000000..7d6a9774 --- /dev/null +++ b/util/README.markdown @@ -0,0 +1,27 @@ +# various utils + +## //util/bin/with + + execute a command with an extended/modified environment + +### usage + + with ENV COMMAND + + where `ENV` is the name of the environment and + `COMMAND` your to-be-executed command (-line). + +### environment + + - `env_dir` defines the directory where environment files are searched. + Default: `$HOME/.env.d`. + +### example + + cat > ~/.with/frh-ire <<EOF + export api_url=... + export api_key=... + export api_hash=... + EOF + + with frh-ire //ext/solus/bin/client info diff --git a/util/bin/with b/util/bin/with new file mode 100755 index 00000000..97893faf --- /dev/null +++ b/util/bin/with @@ -0,0 +1,6 @@ +#! /bin/sh +set -euf +ENV="${env_dir-$HOME/.env.d}/$1" +shift +. "$ENV" +exec "$@" |