diff options
| author | anntnzrb <51257127+anntnzrb@users.noreply.github.com> | 2020-08-27 14:57:16 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-27 15:57:16 -0400 |
| commit | ca9b3952e6481903cdb47810933765fb2cd1ab27 (patch) | |
| tree | 702323b0d55d1562e0e98670e6364e5e17f9adcb /.local/bin | |
| parent | 5fd9637eb7345c2e68ec9a2b5c3116292e7f57e7 (diff) | |
| download | eibhear-ca9b3952e6481903cdb47810933765fb2cd1ab27.tar.gz eibhear-ca9b3952e6481903cdb47810933765fb2cd1ab27.tar.zst eibhear-ca9b3952e6481903cdb47810933765fb2cd1ab27.zip | |
Exit codes, stderr suppression, minor edits (#788)
This is a re-attempt of #643
- `[ "$archive" = "" ]` may be replaced with `[ -z "$archive" ]`
- added exit codes
- upon entering `ext -c` with no arguments stderr will be thrown
from readlink, should be suppressed
Diffstat (limited to '.local/bin')
| -rwxr-xr-x | .local/bin/ext | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/.local/bin/ext b/.local/bin/ext index c5f89c5..806ce5e 100755 --- a/.local/bin/ext +++ b/.local/bin/ext @@ -8,19 +8,19 @@ while getopts "hc" o; do case "${o}" in c) extracthere="True" ;; - *) printf "Options:\\n -c: Extract archive into current directory rather than a new one.\\n" && exit ;; + *) printf "Options:\\n -c: Extract archive into current directory rather than a new one.\\n" && exit 1 ;; esac done if [ -z "$extracthere" ]; then archive="$(readlink -f "$*")" && directory="$(echo "$archive" | sed 's/\.[^\/.]*$//')" && mkdir -p "$directory" && - cd "$directory" || exit + cd "$directory" || exit 1 else - archive="$(readlink -f "$(echo "$*" | cut -d' ' -f2)")" + archive="$(readlink -f "$(echo "$*" | cut -d' ' -f2)" 2>/dev/null)" fi -[ "$archive" = "" ] && printf "Give archive to extract as argument.\\n" && exit +[ -z "$archive" ] && printf "Give archive to extract as argument.\\n" && exit 1 if [ -f "$archive" ] ; then case "$archive" in |
