AppleScript做脚本总是Echos命令
on run argv
set scpt to first item of argv
tell application "Terminal"
do script "bash " & scpt
activate
end tell
end run
问题是我告诉它要执行什么脚本命令,它总是首先在终端中打印该命令。我不希望这种回声行为如何使用AppleScript禁用它。
编辑1:这是纯Applescript逻辑的一个很好的例子,输出看起来很恐怖。现在,尽管您能够进行设置 +v bash命令以关闭回声,请说echo foo
是一个非常长的命令,清除屏幕会引起闪烁。我问如何启用回声或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,但没有维护
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
on run argv
set scpt to first item of argv
tell application "Terminal"
do script "bash " & scpt
activate
end tell
end run
the issue is no matter what script command I tell it to do it always prints that command in terminal first. I don't want this echo behavior how do I disable it with using AppleScript.
Edit 1: this is a good example of pure AppleScript logic and the output looks horrible. Now while your able to do set +v bash command to turn the echo off let's say echo foo
was a really long command clearing the screen causes a flicker. I am asking how to enable echo off or set +v
without causing an echo to begin with?
tell application "Terminal"
set a to do script ""
activate
do script "echo foo" in a
do script "echo ardvark" in a
end tell
Edit 2: I tried using the set +v from bash with clear and it wasn't maintained
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不确定我确切地理解您的问题/需求,但要从我能告诉我的需要的内容相反,因此请阅读您的问题解决了我的问题。
输出与终端相呼应,
没有输出回声
Not sure that I understand your question/need exactly but from what I can tell I had the opposite need and so, reading your question solved mine.
Output is echoed to terminal
No output is echoed to terminal