personal daily use scripts
This commit is contained in:
Executable
+30
@@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
file="$1"
|
||||
w="$2"
|
||||
h="$3"
|
||||
|
||||
case "$(file -Lb --mime-type "$file")" in
|
||||
text/*|application/json|application/x-empty|inode/x-empty)
|
||||
bat --theme="ansi" --color=always --style=numbers --line-range=:500 --terminal-width="$w" "$file"
|
||||
;;
|
||||
image/*)
|
||||
echo "Image: $file"
|
||||
;;
|
||||
application/pdf)
|
||||
pdftotext -l 10 -nopgbrk -q "$file" - | fold -s -w "$w"
|
||||
;;
|
||||
application/zip|application/x-tar|application/x-rar|application/x-7z-compressed|application/gzip|application/x-bzip2|application/x-xz)
|
||||
echo "Archive: $file"
|
||||
echo
|
||||
case "$file" in
|
||||
*.zip) unzip -l "$file" ;;
|
||||
*.tar|*.tar.*|*.tgz) tar tf "$file" ;;
|
||||
*.rar) unrar l "$file" ;;
|
||||
*.7z) 7z l "$file" ;;
|
||||
*) echo "Archive listing not supported" ;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
file -Lb "$file"
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user