[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: dash-as-bin-sh



Hi, Chris!

On Wed, Apr 21, 2010 at 4:55 AM, Chris Davies <chris-usenet@roaima.co.uk> wrote:
If you write your script portably it will work with /bin/sh, for many
values of sh. If you rely on features of ksh or bash you should specify
one of those shells on the #! line.

Of course, you're right about portability -- I run everywhere I'm testing except dash-as-sh ("Debian Future"), but I'm using a non-POSIX feature which is causing me grief. My target platform is "Any modern UNIX, and any modern GNU system", so I suppose I should be digging up a few more bourne shell variants for testing anyhow. (We're primarily a Solaris shop).
 

> 4 - Reason for #2, is there a way to list all functions declared in a script
> with dash?

"set" works for ksh, bash, and dash. On (at least) Solaris 9 & 10 and
Debian. Is that enough?


That was my first thought, except dash only lists variables and not functions.  Interestingly, dash seems to keep functions and variables in separate namespaces -- this must be why 'unset -f' exists.

My current plan is to simply implement the functionality I need by parsing the input script with itself where 'typeset' is not available -- and testing for typeset via feature-testing rather than shell detection.  While annoying, it would seem to be the only truly portable solution.

Thanks,
Wes
 
--
Wesley W. Garland
Director, Product Development
PageMail, Inc.
+1 613 542 2787 x 102

Reply to: