#!/bin/bash # if $1 is a text file, less it if file "$1" | grep -q text; then less -FRX "$1" # otherwise, just dir it else ls -lhAF --color=auto "$@" fi