You can use AppleScript with Terminal to save time or automate redundant tasks. Terminal is a scriptable application and responds to AppleScript commands. These commands are described in detail in Terminal’s AppleScript dictionary.
Drag the Terminal icon onto the Script Editor icon, located in the Utilities folder in the Applications folder.
In AppleScript, the Do Shell Script command can be used to send a UNIX or shell script command to Terminal.
For more information about AppleScript, see the AppleScript website.
For examples of AppleScript scripts you can use with Terminal, see the AppleScript scriptable applications website.