Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Control the Finder with the Terminal' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Control the Finder with the Terminal
Authored by: Lri on Dec 13, '12 11:07:20PM

Here's a simplified function that just makes cd change the directory in Finder.

function cdee() {
	[ $# == 0 ] && \cd ~ || \cd "$1"
	[ $? != 0 ] && return
	osascript -e 'on run pwd
set f to posix file pwd
tell app "Finder"
if number of Finder windows is 0 then
open f
else
set target of window 1 to f
end
end
end' "$PWD" > /dev/null
}

alias cd=cdee


[ Reply to This | # ]