Entering multiple commands in Terminal

I’m trying to enter a few different (but related) commands into a single Terminal window and I don’t know what AS command to use. I’ve tried “do script with command…” but each command is brought up in a new Terminal window. Any ideas?

You can specify the terminal window that will perform the script. You can also use the Unix way of performing several commands in order by placing the commands on a single line and separating by semicolon. You’ll have to quote the command line to get it to work.

tell application "Terminal"
          activate
	do script "cp ~/Documents/Filetobackup ~/Documents/Filetobackup.bak" in window 1
	do script "pico ~/Documents/Filetobackup" in window 1
end tell
tell app "Terminal"
    activate
    do script "cp ~/Documents/Filetobackup ~/Documents/Filetobackup.bak; pico ~/Documents/Filetobackup"
end tell

Do you really need the Terminal in the first place? You can simply use the “do shell script “…”” to issue any commands without actually invoking the Terminal app.

Jon

Unless you wanted to end up in the Terminal? Otherwise, you’re right and a “do shell script” would be sufficient. Without more info from IMacthereforeIAm we don’t know. IMacthereforeIAm?