Created
January 3, 2010 00:57
-
-
Save kch/267759 to your computer and use it in GitHub Desktop.
Awesome bash functions for the mac-minded
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
# Allows gnu du to accept bsd's du -d option by wrapping | |
# gdu and translating -d to --max-depth before calling it. | |
# Useful on linux and solaris | |
du --help 2>&1 | grep -q -- '-d depth' || du () { | |
args=`echo "$@" | perl -pe 's/(-\w*)d(\d+)\b/$1 --max-depth=$2/'` | |
gnu_du=`which gdu du 2>/dev/null | head -1` | |
"$gnu_du" $args | |
} | |
egem () { $EDITOR $(dirname `gem which $@`)/..; } # opens a gem directory in $EDITOR | |
tman () { MANWIDTH=100 MANPAGER='col -bx' man $@ | mate; } # opens a man page in TextMate | |
O () { open ${@:-.}; } # opens current dir or argument in the Finder |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment