:
1) , "cd mydir"
2) , , ( 0), ,
. , , , . , , AppleScriptObjC - :
https://apple.stackexchange.com/questions/39204/script-to-raise-a-single-window-to-the-front
http://tom.scogland.com/blog/2013/06/08/mac-raise-window-by-title/
Script 1 - :
< > /usr/local/bin/terminal-here.sh
#!/bin/sh
osascript `dirname $0`/terminal-here.scpt $1 > /dev/null 2> /dev/null
Script 2 - " AppleScript", :
< > /usr/local/bin/terminal-here.scpt
on run argv
if (count of argv) > 0 then
set mypath to item 1 of argv
else
set mypath to "~"
end if
tell application "System Events"
if (count (processes whose bundle identifier is "com.apple.Terminal")) is 0 then
tell application "/Applications/Utilities/Terminal.app"
do script "stty -echo; cd " & (mypath as text) & ";clear; printf \"\\e[3J\"; stty echo" in window 0
activate last window
end tell
else
tell application "/Applications/Utilities/Terminal.app"
do script "stty -echo; cd " & (mypath as text) & ";clear; printf \"\\e[3J\"; stty echo"
activate last window
end tell
end if
end tell
end run