Usenet comp.unix.tru64 (2000-2013)
 help / color / mirror / Atom feed
From: "Dan Mercer" <dmercer@mn.rr.com>
Subject: Re: Unexpected result from grep
Date: Tue, 23 Dec 2003 16:01:49 GMT	[thread overview]
Message-ID: <NFZFb.159619$Vu6.57918@twister.rdc-kc.rr.com> (raw)
In-Reply-To: bs7msf$19vu$1@jeeves.eng.abbnm.com


"Peter da Silva" <peter@abbnm.com> wrote in message news:bs7msf$19vu$1@jeeves.eng.abbnm.com...
: In article <0z_Eb.170955$Eq1.160079@twister.rdc-kc.rr.com>,
: Dan Mercer <dmercer@mn.rr.com> wrote:
: > Portability using a minimal sh functionality pushes the burden of portability
: > from the shell to the OS.
:
: That's one way of looking at it, I suppose. Really, though, that viewpoint
: is confusing correlation and causation.
:
: Just because you're running ksh or bash or zsh doesn't mean you're running
: a new awk or that perl is installed. Writing a script in a less portable
: way, from the point of view of the shell, doesn't provide any guarantee
: that all the program invocations in the script are going to work. And
: writing it in a more portable way doesn't change the version of awk already
: installed on the target system into gawk.

But it severely lessens the need to invoke awk or sed,  etc.  Because of
extended globbing,  and the new parameter substitution forms,  there is
no need to invoke awk for trivial purposes,  as so often was done in the
past.  The less you need external programs,  the less you need to
worry about their portability.
:
: All you can say is that a system with a newer shell installed is more likely
: to have newer versions of other programs,

Not the point at all.  I had many bourne shell scripts that relied on awk.
Because of problems with the vendor breaking awk,  I switched to gawk.
But that meant I had to support gawk if I continued to use it on a long
term basis (which meant paperwork I won't go into).  After the vendor
broke awk the third time,  I decided to just pull it out of all the scripts.

I was shocked to find the scripts actually executed faster!

 but if other parts of the code
: are non-portable then all you're doing is hiding any deeper problems
: and make it harder to isolate them when they do show up. And in the
: meantime you're adding to system complexity by forcing people to install
: multiple different shells.

Ksh is pretty standard.  Only Linux installs wouldn't come standard,
but there,   at least,  you can install real ksh93.
:
: As for using the "#!/bin/ksh" to discourage the use of older shells, you
: can get the same results by putting that line there without actually using
: a single ksh extension. :)

Which then leaves you at the mercy of the OS.  I find that those who argue
loudest for using the Bourne shell as a standard (ignoring the fact that there
are actually multiple incompatible sh's under that standard) often do so
because they don't know hoe powerful ksh is.
:
: > It's too bad the POSIX shell group did such a poor job - too much
: > infighting from people with vested interests.  Personally,  I would
: > have been perfectly happy had they just said : "We're going to use
: > zsh - get over it."
:
: If they had done that then they would have condemned the POSIX shell to
: complete instead of marginal irrelevance, since they would have been
: even more widely ignored than they are now.

No,  all the major vendors would have adopted zsh.

:
: -rwxr-xr-x   2 bin      bin       131072 Apr 12  1999 /usr/bin/sh
: text    data    bss     dec     hex
: 114688  16384   4752    135824  21290
:
: -rwxr-xr-x   2 bin      bin       270336 Apr 12  1999 /usr/bin/ksh
: text    data    bss     dec     hex
: 229376  40960   17968   288304  46630
:
: -rwxr-xr-x   1 root     system    917504 Nov 23  1999 /usr/local/bin/zsh
: text    data    bss     dec     hex
: 598016  73728   48896   720640  aff00

On my Linux system,  zsh is smaller than bash and much smaller than ksh.
I notice you haven't addressed the problem of conflicting "sh" types -
in which not even echo works reliably.

Dan Mercer

:
: --
: I've seen things you people can't imagine. Chimneysweeps on fire over the roofs
: of London. I've watched kite-strings glitter in the sun at Hyde Park Gate.  All
: these things will be lost in time, like chalk-paintings in the rain.   `-_-'
: Time for your nap.  | Peter da Silva | Har du kramat din varg, idag?    'U`




  reply	other threads:[~2003-12-23 16:01 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-11 16:13 Unexpected result from grep Dan
2003-12-11 16:32 ` Jens Schweikhardt
2003-12-11 16:37 ` Chris F.A. Johnson
2003-12-11 16:47 ` Stephane CHAZELAS
2003-12-11 18:24   ` Joseph Dionne
2003-12-12 13:19     ` Dan
2003-12-19 20:11     ` Peter da Silva
2003-12-20 16:13       ` Dan Mercer
2003-12-22 21:14         ` Peter da Silva
2003-12-23 16:01           ` Dan Mercer [this message]
2003-12-23 21:01             ` Peter da Silva
2003-12-23 22:15               ` Dan Mercer
2003-12-25 22:29                 ` Peter da Silva
2003-12-24 16:41       ` Stephane CHAZELAS
2003-12-25 22:15         ` Peter da Silva
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox