Skip to content

Instantly share code, notes, and snippets.

@XieJiSS
Created April 19, 2019 07:46
Show Gist options
  • Save XieJiSS/501c6e69f0e65acf05dccabe9586dfbe to your computer and use it in GitHub Desktop.
Save XieJiSS/501c6e69f0e65acf05dccabe9586dfbe to your computer and use it in GitHub Desktop.
cdfinder () {
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