Created
January 2, 2020 15:34
-
-
Save BaksiLi/7e66c1f42dcd49821b88bd4d942c0f09 to your computer and use it in GitHub Desktop.
Shell function cd for macOS alias
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
# Function for macOS alias | |
cda () { | |
thePath=`osascript <<EOD | |
set toPath to "" | |
tell application "Finder" | |
set toPath to (POSIX file "$1") as alias | |
set theKind to kind of toPath | |
if theKind is "Alias" then | |
set toPath to ((original item of toPath) as alias) | |
end if | |
end tell | |
return posix path of (toPath) | |
EOD` | |
builtin cd "$thePath" >> /dev/null 2>&1; | |
} >> /dev/null 2>&1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment