Re: (patch for Bash) arrayzip, arrayunzip

From: William Park (opengeometry_at_yahoo.ca)
Date: 10/21/04


Date: 21 Oct 2004 00:49:48 GMT

Kenny McCormack <gazelle@yin.interaccess.com> wrote:
> In article <slrncnch8p.2ec.stephane.chazelas@spam.is.invalid>,
> Stephane CHAZELAS <this.address@is.invalid> wrote: ...
> >> - double and triple quoting give me headache.
> >
> >Then use intermediate variables/functions, or use a real programming
> >language.
>
> He did. I think most of us here would consider "C" to be a "real
> programming language".
>
> The point is that it looks like William is taking the view that it is
> just as easy to add features via writing C code as it is to do it
> writing shell code. And the thing is, once you get in the groove of
> writing stuff in C, it can be just as easy as writing in a script
> language.
>
> The only problem with all this is that it is O/T in a shell
> programming group.

I think it's very relevant, because it allows comparison and learning.

Although 'arrayzip' and 'arrayunzip' are much easier in C (I don't see
how anyone could recommend Stephane's code over mine), you do have point
on strcat(3) and strcpy(3) emulation I wrote. There, pure shell
functions are only 5 times slower than C versions, which is pretty good
considering that it's shell script vs. C.

For reference, the strcat(), strcpy(), strlen(), strcmp() functions can
be found at
    http://home.eol.ca/~parkw/index.html#string

-- 
William Park <opengeometry@yahoo.ca>
Open Geometry Consulting, Toronto, Canada


Relevant Pages

  • Re: parse each line in a file
    ... > I am writing a shell script that searches a file containing a list ... A perl solution would be faster, but since u wanted a shell based ...
    (comp.unix.shell)
  • Re: Safeway Bingo
    ... >>Canadian Safeway is launching a Bingo game to attract customers. ... Each shell ... IS a programming language by definition. ... hard to "translate" the BASIC script to a shell script; ...
    (comp.unix.shell)
  • Re: truncating characters using sed
    ... > right to leave a variable unquoted in a script even if it may ... but the shell script is so trivial and quick ... > have come to with a real programming language. ... Since, as I mentioned, you had already posted a good awk solution, I ...
    (comp.unix.questions)
  • Re: Secure issues on the usage of exec
    ... With ksh93, the problem is only that if those ... That's the same with any other command than sleep. ... I use a programming language for programming and a powerful ... either but at least are much more usable as a shell). ...
    (comp.unix.shell)
  • Re: truncating characters using sed
    ... That's a matter of advertising the /right/ solution when posting ... > real script uses all the fields or wants to specify a different output ... > to someone the other day and it wasn't available in whatever shell they ... have come to with a real programming language. ...
    (comp.unix.questions)