The syntax highlighting for below shell script is incorrect, the nested parenthesis are not properly handled. No idea if this can be easily fixed...
Gerd
#!/bin/sh
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 ) cd "$currFolderPath"