on run argv
set scpt to first item of argv
tell application "Terminal"
do script "bash " & scpt
activate
end tell
end run
问题是无论我告诉它做什么脚本命令,它总是首先在终端打印该命令。我不想要这个echo行为,我如何使用AppleScript禁用它。
编辑1:这是一个纯AppleScript逻辑的好例子,输出看起来很糟糕。现在,当你能够执行set +v bash命令来关闭回显时,假设echo foo
是一个非常长的命令,清除屏幕会导致闪烁。我想问的是,如何启用echo off或set +v
而不会引起回声?tell application "Terminal"
set a to do script ""
activate
do script "echo foo" in a
do script "echo ardvark" in a
end tell
编辑2:我尝试使用bash的set +v和clear,它没有维护
tell application "Terminal"
set a to do script ""
activate
do script "bash -c "set +v" ; clear" in a
do script "echo foo" in a
do script "echo hello world" in a
end tell
我不确定我完全理解你的问题/需求,但据我所知,我有相反的需求,所以,阅读你的问题解决了我的问题。
# launch application
tell application "Terminal"
set a to do script "/path/script.sh"
activate
end tell
输出回显到终端
# launch application
tell application "Terminal"
activate
do shell script "/path/script.sh"
end tell
终端
无输出