diff options
author | tv <tv@nomic.retiolum> | 2013-01-30 14:56:37 +0100 |
---|---|---|
committer | tv <tv@nomic.retiolum> | 2013-01-30 14:56:37 +0100 |
commit | 1aef05b59c51c2e515b0cee03e8b8c45a9108def (patch) | |
tree | d84da58f48edfbd275ae0ccd2526b2fb09abb784 | |
parent | 609dd2e9e89c047399ab2e554e3411df7e6e2676 (diff) |
//util with: initial commit
-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 "$@" |