Created
August 22, 2014 13:00
-
-
Save myfavouritekk/e99915c54c61e9819511 to your computer and use it in GitHub Desktop.
OS X: Change directory in Terminal, Sync folder in Finder window.
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
# change directory and sync Finder window | |
sd () { | |
# change terminal directory | |
cd "$@" || return | |
# sync Finder window or open new one if not exists | |
osascript -e "tell application \"Finder\" | |
if front Finder window exists then | |
set target of front Finder window to (""\"$PWD\""" as POSIX file) | |
else | |
open (""\"$PWD\""" as POSIX file) | |
end if | |
end tell" > /dev/null | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment