dotfiles/.local/bin/b

11 lines
432 B
Bash
Executable File

#!/bin/sh
# Show type & contents of given files or PWD
for last; do true; done
last=${last:-.}
file "$last" | grep -v --color=never directory
case "$(file --dereference --mime "$last")" in
*inode/directory*) ls -l --color=auto --human-readable --group-directories-first --file-type --dereference-command-line --all --reverse "$@";;
*binary) ;;
*) $(test -r "$last" && echo "bat" || echo "sudo bat") --style header "$@";;
esac