Handy scripts for personal use
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
431 B

#!/bin/bash
# if stdin is coming from a pipe, run less
if [[ ! -t 0 ]]; then
less -FX
# if there is only one arg and it is not a directory, less it
elif [[ "$#" -eq 1 && ! -d "$1" ]]; then
less -FX "$1"
# if there are exactly two arguments and neither is a directory, diff them
elif [[ "$#" -eq 2 && ! -d "$1" && ! -d "$2" ]]; then
diff --color=auto -u "$@"
# otherwise, run dir
else
ls -lhAF --color=auto "$@"
fi