dotfiles/scripts/p
2023-05-29 23:22:15 -06:00

12 lines
324 B
Bash
Executable file

#!/bin/sh
# Preview files & dirs
file="$1"
# If directory, list contents
[ -d "$file" ] && (cd "$file" && /usr/bin/ls -A1Fx --color --group-directories-first)
case $file in
*.csv) column -s, -t < "$file" ;;
*.html) links -dump "$file" ;;
*) ! [ -d "$file" ] && head -n 47 "$file" && printf "\n\n ..." ;;
esac