Created
December 29, 2013 19:33
-
-
Save dalemanthei/8173899 to your computer and use it in GitHub Desktop.
A .bash_profile snippet for Mac OS X from http://brettterpstra.com/2013/02/09/quick-tip-jumping-to-the-finder-location-in-terminal/ with added snippet for Path Finder.
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
# from http://brettterpstra.com/2013/02/09/quick-tip-jumping-to-the-finder-location-in-terminal/ | |
# cd to the path of the front Finder window | |
cdf() { | |
target=`osascript -e 'tell application "Finder" to if (count of Finder windows) > 0 then get POSIX path of (target of front Finder window as text)'` | |
if [ "$target" != "" ]; then | |
cd "$target"; pwd | |
else | |
echo 'No Finder window found' >&2 | |
fi | |
} | |
# And a Path Finder version of the same | |
cdpf() { | |
target=`osascript -e 'tell application "Path Finder" to if (count of Finder windows) > 0 then get POSIX path of (target of the front finder window)'` | |
if [ "$target" != "" ]; then | |
cd "$target"; pwd | |
else | |
echo 'No Path Finder window found' >&2 | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment