1 2 3 4 5 6 7 8 9 10
# self-explaining, I think if [[ -f "$1" ]]; then case "$1" in *.bz2) bzless "$1" ;; *.gz) zless "$1" ;; *) less "$1" ;; esac else echo "No such file, dude." fi