Chapter 34. Executing Scripts with the Terminal App

In a dramatic departure from prior operating systems, but a welcome one for many Macintosh scripters, Mac OS X comes equipped with a command-line interface (CLI) to its underlying filesystem and applications. In a throwback to old-fashioned ways of interacting with a computer, a CLI involves entering text commands from the keyboard into a window that contains only a prompt in the form of a solid square cursor, percent sign, or some other symbol. You can access the command line from the Mac OS X graphical user interface (GUI) by executing the Terminal app from the directory startup disk:Applications:Utilities (or, in Unix parlance, /applications/utilities/ ). This program displays the CLI window. Some users, viewing Terminal as primitive and an unforgivable violation of Apple Computer’s rich tradition of visual interfaces, will steer clear of the CLI. (Okay, so the Terminal isn’t that primitive; you can control the size of its window and the font of its displayed text, among other attributes.) However, Terminal gives you access to system directories and files you cannot see in Finder windows, which is critical for system administrators. In addition, the Unix-derived software you can use from the command line, including the text editors pico, vi, and emacs, as well as the scripting languages Perl, tcl, and awk and all of the built-in BSD Commands (e.g., ls, pwd, mv, rm), are often indispensable accompaniments to AppleScript and ...

Get AppleScript in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.