From eef5ee647912dd3383833672b0e9ad6a9d3358a1 Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Sat, 8 Jan 2022 23:09:59 +0100 Subject: [PATCH] bin: refinements --- .local/bin/scripts/b | 4 ++++ .local/bin/scripts/ex | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.local/bin/scripts/b b/.local/bin/scripts/b index c667633..6fe0fd8 100755 --- a/.local/bin/scripts/b +++ b/.local/bin/scripts/b @@ -47,6 +47,10 @@ declare -a timg timga bat batl ls for arg; do case "$arg" in (-*) args="$args $arg"; continue;; esac checkperm "$arg" + if ! $elevate test -e "$arg" + then echo "File not found: '$arg'" 1>&2 + continue + fi grid=$(expr $(tput cols) / 20) tmpfile="$prefix/$(basename "$arg")" case "$mime" in diff --git a/.local/bin/scripts/ex b/.local/bin/scripts/ex index 63fe586..d7a15a4 100755 --- a/.local/bin/scripts/ex +++ b/.local/bin/scripts/ex @@ -19,11 +19,11 @@ for arg do (*.tar.*|*.tar) tar --extract --file "$path";; (*.tbz2) tar xjf "$path" ;; (*.tgz) tar xzf "$path" ;; - (*.zip|*.jar) unzip "$path" | rewrite ;; + #(*.zip|*.jar) unzip "$path" | rewrite ;; + (*.7z|*.z01|*.zip|*.jar) 7z x "$path" ;; (*.gz) gunzip "$path" ;; (*.bz2) bunzip2 "$path" ;; (*.rar) unrar x "$path" ;; - (*.7z|*.z01) 7z x "$path" ;; (*.deb) ar x "$path" ;; (*.zst) unzstd "$path" ;; (*.Z) uncompress "$path";; @@ -32,7 +32,7 @@ for arg do test "$(basename "$PWD")" = "$namepart" && if test "$(ls -U | wc -l)" -lt 3 then mv * .. && cd .. && rm -d "$namepart" - else mv "$namepart" "$name" + else cd .. && mv "$namepart" "$name" fi ) else