dotfiles/.local/bin/b

12 lines
494 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
stat -c 'Permissions: %A, Created: %.10w, Modified %.10y, Size: %s' "$last"
case "$(file --dereference --mime "$last")" in
*inode/directory*) ls -l --color=always --human-readable --group-directories-first --file-type --dereference-command-line --almost-all "$@";;
*binary) ;;
*) $(test -f "$last" -a ! -r "$last") bat --style header "$@";;
esac