unset FOO

2008-09-17 Thread Peter Seebach
In regards to worries about "unset FOO" not working if FOO is not set: ${FOO+unset FOO} Is this crazy or clever? It works in Solaris sh. (I know, in most cases, it's sufficient to just empty the variable, but sometimes it'd be nice to be able to distinguish between empty and unset.) -s

Re: libraries of shell script functions

2008-09-17 Thread Matthew Woehlke
Bruno Haible wrote: If you want to contribute shell script functions to gnulib, we would need some kind of "linker" for shell scripts: A tool which combines a set of shell script fragments, each defining a number of functions, and a "main" script, into a complete, runnable shell script. Does some

Re: libraries of shell script functions

2008-09-17 Thread Peter Seebach
In message <[EMAIL PROTECTED]>, Bruno Haible writes: >If you want to contribute shell script functions to gnulib, we would need some >kind of "linker" for shell scripts: A tool which combines a set of shell >script fragments, each defining a number of functions, and a "main" script, >into a complet

Re: libraries of shell script functions

2008-09-17 Thread Bruno Haible
Hi, If you want to contribute shell script functions to gnulib, we would need some kind of "linker" for shell scripts: A tool which combines a set of shell script fragments, each defining a number of functions, and a "main" script, into a complete, runnable shell script. Does someone already have

Re: ksh's select, almost, in portable shell

2008-09-17 Thread Peter Seebach
In message <[EMAIL PROTECTED]>, Ralf Wildenhues writes: >> I enclose func_select below. Weaknesses: >> 1. Newline after prompt. (Solving this portably seemed like too much work.) >Grab the settings of ECHO_C, ECHO_N, ECHO_T from Autoconf, and use them. ECHO_T? New on me. I could probably do

Re: ksh's select, almost, in portable shell

2008-09-17 Thread Ralf Wildenhues
* Peter Seebach wrote on Wed, Sep 17, 2008 at 08:07:19PM CEST: > > But you can implement a shell function such that > > while func_select var in args > do > done > > is equivalent (nearly) to > > select var in args > do > done > > I enclose func_select below. Weaknesses: > 1. Newline after p

Re: Somewhat off-topic, but hard to find better portability people.

2008-09-17 Thread Peter Seebach
In message <[EMAIL PROTECTED]>, Ralf Wildenhues writes: >> [EMAIL PROTECTED] (Peter Seebach) wrote: >> > I've been getting utterly stunned pretty regularly throughout. The only >> > system I've found so far, other than embedded systems (hi, busybox!), which >> > doesn't have printf(1) either in th

Re: Somewhat off-topic, but hard to find better portability people.

2008-09-17 Thread Ralf Wildenhues
> [EMAIL PROTECTED] (Peter Seebach) wrote: > > I've been getting utterly stunned pretty regularly throughout. The only > > system I've found so far, other than embedded systems (hi, busybox!), which > > doesn't have printf(1) either in the shell or in the default $PATH, is SunOS > > 4 -- which I'm

ksh's select, almost, in portable shell

2008-09-17 Thread Peter Seebach
This came from a pair of sources; my work on portable shell, and the discovery that glibc's tzselect "requires ksh". Originally, I thought "there's no way you could implement select in a shell which doesn't have it, because it's a control structure". And indeed, you can't. But you can implement

Re: Issue with ls -v / sort -V and strverscmp() usage

2008-09-17 Thread Kamil Dudka
Hello Bruno, thanks for excellent review. When the function's behavior is definitely accepted by people here, I will improve its implementation. On Wednesday 17 September 2008 13:13:03 you wrote: > There are still a few things to do before we can add it to gnulib: > - Do you have a copyright a

Re: Issue with ls -v / sort -V and strverscmp() usage

2008-09-17 Thread Bruno Haible
Hello Kamil, Kamil Dudka wrote: > I ran a few series of tests with all implementations. I think the > modified version of ververcmp (from dpkg) gives the best results - consider > attached results of an example - results.tar.bz2 I agree, out-deb-patched matches most closely what one would expec

Re: Issue with ls -v / sort -V and strverscmp() usage

2008-09-17 Thread Kamil Dudka
On Sunday 07 September 2008 08:28:11 Jim Meyering wrote: > IMHO, changing sort -V to produce more intuitively-correct results > is the way to go. > > With ls -v, I'm willing to make the change as well, *assuming* > no one produces a counterargument. > > The question is what ordering function to use

Re: Somewhat off-topic, but hard to find better portability people.

2008-09-17 Thread Jim Meyering
[EMAIL PROTECTED] (Peter Seebach) wrote: ... > The sort of rough cutoff I picked, perhaps arbitrarily, was "systems with Y2K > fixes". So, Solaris 2+, but not Solaris 1/SunOS 4. > > I've been getting utterly stunned pretty regularly throughout. The only > system I've found so far, other than embe

Re: Somewhat off-topic, but hard to find better portability people.

2008-09-17 Thread Peter Seebach
In message <[EMAIL PROTECTED]>, Ralf Wildenhues writes: >Quoting the Autoconf manual: >| `unset' >| In some nonconforming shells (e.g., Bash 2.05a), `unset FOO' fails >| when `FOO' is not set. Also, Bash 2.01 mishandles `unset MAIL' in >| some cases and dumps core. >So look for sys