Scientist1642
Scientist1642

Reputation: 1202

hide the bash input in terminal

I'm executing a bash command from AppleScript but the script is quite ugly and I am only interested to see the output in a terminal.

Example:

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

Terminal(I want to hide pwd):

pwd 
/Users/jdoe

Upvotes: 0

Views: 770

Answers (2)

Lri
Lri

Reputation: 27613

If you use clear (or tput clear or printf \\ec), the old contents are shown if you scroll up:

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

This can have a noticeable delay if System Events is not running:

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

Upvotes: 2

Ansgar Wiechers
Ansgar Wiechers

Reputation: 200293

The command is do shell script "pwd", and it did show only the output when I ran it in Script Editor or via osascript test.scpt in a Terminal.

Upvotes: 1

Related Questions