bin: refinements

This commit is contained in:
xeruf 2022-01-08 23:09:59 +01:00
parent adc5c29e1e
commit eef5ee6479
2 changed files with 7 additions and 3 deletions

View File

@ -47,6 +47,10 @@ declare -a timg timga bat batl ls
for arg; do for arg; do
case "$arg" in (-*) args="$args $arg"; continue;; esac case "$arg" in (-*) args="$args $arg"; continue;; esac
checkperm "$arg" checkperm "$arg"
if ! $elevate test -e "$arg"
then echo "File not found: '$arg'" 1>&2
continue
fi
grid=$(expr $(tput cols) / 20) grid=$(expr $(tput cols) / 20)
tmpfile="$prefix/$(basename "$arg")" tmpfile="$prefix/$(basename "$arg")"
case "$mime" in case "$mime" in

View File

@ -19,11 +19,11 @@ for arg do
(*.tar.*|*.tar) tar --extract --file "$path";; (*.tar.*|*.tar) tar --extract --file "$path";;
(*.tbz2) tar xjf "$path" ;; (*.tbz2) tar xjf "$path" ;;
(*.tgz) tar xzf "$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" ;; (*.gz) gunzip "$path" ;;
(*.bz2) bunzip2 "$path" ;; (*.bz2) bunzip2 "$path" ;;
(*.rar) unrar x "$path" ;; (*.rar) unrar x "$path" ;;
(*.7z|*.z01) 7z x "$path" ;;
(*.deb) ar x "$path" ;; (*.deb) ar x "$path" ;;
(*.zst) unzstd "$path" ;; (*.zst) unzstd "$path" ;;
(*.Z) uncompress "$path";; (*.Z) uncompress "$path";;
@ -32,7 +32,7 @@ for arg do
test "$(basename "$PWD")" = "$namepart" && test "$(basename "$PWD")" = "$namepart" &&
if test "$(ls -U | wc -l)" -lt 3 if test "$(ls -U | wc -l)" -lt 3
then mv * .. && cd .. && rm -d "$namepart" then mv * .. && cd .. && rm -d "$namepart"
else mv "$namepart" "$name" else cd .. && mv "$namepart" "$name"
fi fi
) )
else else