Files
dotfiles/scripts/f
2025-11-09 00:19:54 -07:00

30 lines
358 B
Bash
Executable File

#!/bin/sh
path=$1
if [ -z "$path" ]; then
path="."
fi
if [ -d "$path" ]; then
ls -lha --color=tty "$path"
else
if [ ! -f "$path" ]; then
echo "No such file: $path"
exit 0
fi
format="$(file -i "$path" | cut -d' ' -f2)"
format="${format%%/*}"
case "$format" in
"image")
kitty +kitten icat "$path"
;;
*)
cat "$path"
;;
esac
fi