What Is POSIX?


The early days of Unix were like the mythical Wild West, with companies innovating and taking the operating system in quite different directions while simultaneously assuring customers that the new operating systems were compatible and just like the other Unixes. The Institute for Electrical and Electronic Engineers (IEEE) stepped in and, with a tremendous amount of effort from all the major Unix vendors , created a standard version of Unix called POSIX, against which all the commercial and open source Unix implementations are measured. You can't buy a POSIX operating system per se, but the Unix or Linux you run is POSIX compliant.

Yet even POSIX-compliant Unix implementations can vary. One example of this that will be addressed later in this chapter involves the echo command. Some versions of this command support an -n flag, which disables the trailing newline that's a standard part of the command execution. Other versions of echo support the \c escape sequence as a special "don't include a newline" notation, while still others ignore it all and have no apparent way to avoid newlines. To make things even more puzzling, some command shells have a built-in echo function that ignores the -n and \c flags, while the same Unix system usually also has a stand-alone binary /bin/echo that understands these flags. This makes prompting for input in a shell script quite tough, because ideally the script should work identically on as many Unix systems as possible. For functional scripts, needless to say, it's critical to normalize the echo command, and that's just one of the many scripts included in this book.

Let's get started looking at actual scripts to include in our shell script library.




Wicked Cool Shell Scripts. 101 Scripts for Linux, Mac OS X, and Unix Systems
Wicked Cool Shell Scripts
ISBN: 1593270127
EAN: 2147483647
Year: 2004
Pages: 150
Authors: Dave Taylor

Similar book on Amazon

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