function ff { osascript -e 'tell application "Finder"' \press Enter, then type cdff and press Enter. You will see that now the current folder in Terminal is the same as in the opened Finder.
-e "if (${1-1} <= (count Finder windows)) then" \
-e "get POSIX path of (target of window ${1-1} as alias)" \
-e 'else' -e 'get POSIX path of (desktop as alias)' \
-e 'end if' -e 'end tell'; };\
function cdff { cd "`ff $@`"; };
You can save this function in .profile, re-open Terminal session and now, to switch to the folder opened in Finder, type 'cdff'.
Nice?
Don't tell me that you simply could drag an item from the Finder to the Terminal Window. :)
(If someone doesn't know, in Terminal type "cd ", then drag from the Finder Window the tiny icon near the folder name:
No comments:
Post a Comment