Chapter 13. Mixing AppleScript and Unix


Although Mac OS X is one of the nicest looking operating systems around, its Unix core is decidedly ugly. In Unix, you run programs by typing their names, not by double-clicking their icons. And not only that, if you misspell a Unix program's nameor even mis-capitalize itthe program simply won't run.

Still, Unix is the foundation of Mac OS X, and it's got a few benefits to its name. For one, Unix is much older than Mac OS X, and it's been refined by generations of programmers. As a result, it's efficient, secure, and crash-resistant to its core.

As if that weren't enough, Unix is a power user's dream. Often-used programs have quick, short names (ls, cp, and mv, for example), and you can redirect the results of one program into a completely separate program with the pipe symbol, a simple vertical bar (|). And since Unix was invented in the days before graphical operating systems, it's got tons of timesaving keyboard shortcutslike pressing the up arrow key to run a previous Unix program.

Finally, there are some things you can only do with Unix. To tweak hidden Mac OS X settings, for example, you have to use a special Unix program called defaults. Or, if you want to admire how long your computer's been running, the uptime program comes in handy. Either way, you're getting information you can't find anywhere else.

The example scripts from this chapter can be found on the AppleScript Examples CD (see Sidebar 2.1 for instructions).



AppleScript. The Missing Manual
AppleScript: The Missing Manual
ISBN: 0596008503
EAN: 2147483647
Year: 2003
Pages: 150

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net