bin: improve many sctipts, add dif & bak

This commit is contained in:
xerus2000 2021-01-07 12:01:15 +01:00
parent d93f38bb93
commit d6e07da75e
6 changed files with 13 additions and 5 deletions

View File

@ -11,6 +11,6 @@ test -e "$last" || exit 1
case "$(file --dereference --mime "$last")" in case "$(file --dereference --mime "$last")" in
*inode/directory*) ls -l --color=always --human-readable --group-directories-first --file-type --dereference-command-line --almost-all "$@";; *inode/directory*) ls -l --color=always --human-readable --group-directories-first --file-type --dereference-command-line --almost-all "$@";;
*binary) ;; *binary) ;;
*) $(test -f "$last" -a ! -r "$last") bat --style header "$@";; *) $(test -f "$last" -a ! -r "$last" && echo "sudo") bat --style header "$@"
stat -c '%A size %sB, birth: %.10w mod %.10y' "$last";;
esac esac
stat -c 'Permissions: %A, Created: %.10w, Modified %.10y, Size: %s' "$last"

2
.local/bin/bak Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
test -f "$1.bak" && (mv "$1" /tmp && mv "$1.bak" "$1") || mv "$1" "$1.bak"

3
.local/bin/dif Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
# diff with pagination
diff --color=always "$@" | less --quit-if-one-screen

View File

@ -16,7 +16,7 @@ if test -f $1 && test -r $1; then
*.7z) 7z x $1 ;; *.7z) 7z x $1 ;;
*.deb) ar x $1 ;; *.deb) ar x $1 ;;
*.tar.xz) tar xf $1 ;; *.tar.xz) tar xf $1 ;;
*.tar.zst) unzstd $1 ;; *.zst) unzstd $1 ;;
*) echo "'$1' cannot be extracted via ex()" ;; *) echo "'$1' cannot be extracted via ex()" ;;
esac esac
else else

View File

@ -1,3 +1,6 @@
playlistPath="$MUSIC/Playlists" playlistPath="$MUSIC/Playlists"
result="$(test "$1" && (find -L $playlistPath -iname "focus-$1.m3u8" | grep . || find -L $playlistPath -iname "$1.m3u*" | grep . || find -L $MUSIC -iname "*$1*") | head -1 || echo "$playlistPath/focus.m3u8" )" test -z "$1" && vp "$playlistPath/focus.m3u8" ||
test "$result" && vp "$result" (find -L $playlistPath -iname "focus-$1.m3u8" -print0 | grep --null-data . ||
find -L $playlistPath -iname "$1.m3u*" -print0 | grep --null-data . ||
find -L $MUSIC -iname "*$1*" -prune -exec find {} -size +2M -type f -not -iregex ".*.\(jpe?g\|png\)" -print0 \;) |
xargs -0 vp

Binary file not shown.