Skip to content

Instantly share code, notes, and snippets.

@philipmat
Created June 15, 2014 14:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save philipmat/504e95dac9323bb8cc48 to your computer and use it in GitHub Desktop.
Save philipmat/504e95dac9323bb8cc48 to your computer and use it in GitHub Desktop.
dcat = ls + cat - treat files and directories uniformly
# alias d="dcat"
# d ~/Documents/
# d .gitignore
#
function dcat() {
local path=${1:-.}
if [[ -d "$path" ]] ; then
ls -al "$path"
elif [[ -f "$path" ]] ; then
cat "$path"
else
echo "Don't know what to do to $path"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment