Steve Greenland <[EMAIL PROTECTED]> writes: > On 11-Feb-07, 13:40 (CST), Russ Allbery <[EMAIL PROTECTED]> wrote:
>> Yup. You get very used to writing in the restricted common subset when >> you have software that has to work on Solaris /bin/sh, but remembering >> what's allowed and what isn't is complex enough that it's a lot easier >> to write *all* your shell scripts in that restricted common subset and >> be sure. > I gave up trying to keep track. Instead, I use this fragment at the > beginning of scripts that need to run on Solaris so they have a POSIX > shell: [snip switching to /usr/xpg4/bin/sh] I think a lot of this depends on when you started writing shell scripts and how much effort you put since into learning the new stuff introduced later. When I first started doing this stuff, the platforms between which I cared about portability were SunOS, ULTRIX, AIX (I think 3), and NeXTSTEP. I learned the shell language that they all supported, and that's what I wrote shell scripts in. Since then, I did some work on Autoconf macros, which teaches you even more paranoia about supported shell features. I've never felt much need to learn the new shell stuff except to the degree I need to to maintain other people's software. The feature set supported back then, plus some minor use of shell functions (which Solaris sh does support), is enough to do anything I've wanted to in shell that wasn't crying out for a higher-level language like Python or Perl. It still doesn't bother me to write in that portable subset, so adding code to switch to the POSIX sh on Solaris (and then making sure that it's installed everywhere -- we don't install the xpg4 utilities on our systems normally) is more trouble than it's worth. -- Russ Allbery ([EMAIL PROTECTED]) <http://www.eyrie.org/~eagle/> -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]