Created
June 15, 2014 14:42
-
-
Save philipmat/504e95dac9323bb8cc48 to your computer and use it in GitHub Desktop.
dcat = ls + cat - treat files and directories uniformly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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