Skip to content

Instantly share code, notes, and snippets.

@JeremyIglehart
Created February 16, 2016 04:08
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 JeremyIglehart/988f90f6d557f2d59136 to your computer and use it in GitHub Desktop.
Save JeremyIglehart/988f90f6d557f2d59136 to your computer and use it in GitHub Desktop.
cdf command
# Add the below lines to your .profile
# 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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment