Bash Applescript:iTerm从调用脚本的窗口拆分窗格
下面的脚本尝试垂直拆分窗口,并在新窗格中跟踪日志文件Bash Applescript:iTerm从调用脚本的窗口拆分窗格,bash,applescript,iterm2,iterm,osascript,Bash,Applescript,Iterm2,Iterm,Osascript,下面的脚本尝试垂直拆分窗口,并在新窗格中跟踪日志文件 #!/bin/bash COMMAND="tail -f log_file" # Do something important. sleep 4 # Split the window, and tail logs. osascript <<-EOF tell application "iTerm" tell current session of current window split vertica
#!/bin/bash
COMMAND="tail -f log_file"
# Do something important.
sleep 4
# Split the window, and tail logs.
osascript <<-EOF
tell application "iTerm"
tell current session of current window
split vertically with default profile command "$COMMAND"
end tell
end tell
EOF
#/bin/bash
COMMAND=“tail-f日志文件”
#做一些重要的事情。
睡眠4
#拆分窗口和尾部日志。
osascript在脚本开始时获取当前会话的ID
在脚本的后面,获取与此标识符对应的会话
#!/bin/bash
myID=$(osascript -e 'tell application "iTerm" to id of current session of current window')
COMMAND="tail -f log_file"
# Do something important.
sleep 4
# Split the window, and tail logs. myID2 is the id of the new session (the split pane)
myID2=$(osascript <<-EOF
tell application "iTerm"
repeat with w in windows
repeat with t in tabs of w
tell (first session of t whose its id = "$myID")
if exists then return id of (split vertically with default profile command "$COMMAND")
end tell
end repeat
end repeat
end tell
EOF)
#/bin/bash
myID=$(osascript-e'将应用程序“iTerm”告知当前窗口当前会话的id')
COMMAND=“tail-f日志文件”
#做一些重要的事情。
睡眠4
#拆分窗口和尾部日志。myID2是新会话(拆分窗格)的id
myID2=$(osascript工作正常,谢谢。是否有可能存在多个具有相同Id的窗口?