Skip to content

Instantly share code, notes, and snippets.

@dariobanfi
Created February 19, 2021 09:30
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 dariobanfi/672c80d1ce54ef4628eab19ff909861d to your computer and use it in GitHub Desktop.
Save dariobanfi/672c80d1ce54ef4628eab19ff909861d to your computer and use it in GitHub Desktop.
cdf command
# 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
}c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment