隐藏终端中的bash输入

时间:2013-07-20 09:33:04

标签: bash terminal applescript

我正在从AppleScript执行bash命令,但脚本非常难看,我只对在终端中看到输出感兴趣。

示例:

tell application "Terminal"
    do script "pwd"
end tell

终端(我想隐藏密码):

pwd 
/Users/jdoe

2 个答案:

答案 0 :(得分:2)

如果您使用clear(或tput clearprintf \\ec),则向上滚动会显示旧内容:

tell application "Terminal"
    do script " clear; pwd"
    activate
end tell

如果系统事件未运行,则可能会有明显的延迟:

tell application "Terminal"
    do script " osascript -e 'tell app \"system events\" to keystroke \"k\" using command down'; pwd"
    activate
end tell

答案 1 :(得分:1)

该命令为do shell script "pwd",当我在脚本编辑器中运行它或在终端中通过osascript test.scpt时,它确实只显示了输出。

相关问题