diff options
author | EuAndreh <eu@euandre.org> | 2022-08-13 10:58:10 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2022-08-13 10:58:10 -0300 |
commit | a0188f38d8a9702dd3d7119375173d063a5f28bc (patch) | |
tree | 3ff6e25d0125cef5d7d7db0a7ace05a71d586166 /bin/without-env | |
parent | bin/httpno: Add working utility (diff) | |
download | dotfiles-a0188f38d8a9702dd3d7119375173d063a5f28bc.tar.gz dotfiles-a0188f38d8a9702dd3d7119375173d063a5f28bc.tar.xz |
bin/: Replace usage of assert_arg with assert-arg
Diffstat (limited to 'bin/without-env')
-rwxr-xr-x | bin/without-env | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/bin/without-env b/bin/without-env index 45c41ca..4f8fb14 100755 --- a/bin/without-env +++ b/bin/without-env @@ -57,16 +57,9 @@ while getopts 'h' flag; do done shift $((OPTIND - 1)) -assert_arg() { - if [ -z "$1" ]; then - printf 'Missing %s\n' "$2" >&2 - exit 2 - fi -} - -assert_arg "${1:-}" 'ENVVAR' -assert_arg "${2:-}" 'PATH' -assert_arg "${3:-}" '--' +eval "$(assert-arg "${1:-}" 'ENVVAR')" +eval "$(assert-arg "${2:-}" 'PATH')" +eval "$(assert-arg "${3:-}" '--')" eval "export $1=\"\$(echo \"\$$1\" | sed \"s|\$2:||g\")\"" shift # drop $1 |