Summary
The POSIX standard makes a yeoman effort to make portable shell scripting possible. And if you stay within the bounds of what it defines, you have a fighting chance at writing portable scripts. However, the real world remains a messy place. While bash and ksh93 provide a number of extensions above and beyond POSIX, things aren't always 100 percent compatible between the two shells. There are a large number of small Section 14.1 to watch out for, even in simple areas like set options or saving the shell's complete state.
The shopt command lets you
control bash's behavior. We
particularly recommend enabling the extglob option for interactive use.
bash and ksh93 share a number of common extensions that
are very useful for shell programming: the select loop, the [[...]]
extended test facility, extended pattern matching, brace expansion,
process substitution, and indexed arrays. We also described a number of
small but useful miscellaneous extensions. The arithmetic for loop and the ((...))
arithmetic command are perhaps the most notable of these.
Source code for bash and ksh93 is available for download from the Internet, and we showed how to build both shells. We also mentioned two other popular extended Bourne-style shells, pdksh and zsh.
We showed how to determine the version of the shell you're running for the popular extended Bourne-style shells. This is important for when you need to know exactly what program you're using.
Finally, different implementations of the Bourne shell ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access