Skip to content

Instantly share code, notes, and snippets.

@akirk
Created February 26, 2013 10:09
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 akirk/5037432 to your computer and use it in GitHub Desktop.
Save akirk/5037432 to your computer and use it in GitHub Desktop.
except from my ~/.profile . i use this all the time!
# change directory to the currently open finder window.
cdf () {
currFolderPath=$( /usr/bin/osascript << EOT
tell application "Finder"
try
set currFolder to (folder of the front window as alias)
on error
set currFolder to (path to desktop folder as alias)
end try
POSIX path of currFolder
end tell
EOT
)
echo "cd \"$currFolderPath\""
cd "$currFolderPath"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment