tech-userlevel archive

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

Re: sh(1) vs. ksh(1)

    Date:        Sat, 25 Oct 2008 22:16:28 +0000 (UTC)
    From: (Christos Zoulas)
    Message-ID:  <ge05rs$983$>

  | In article <>,
  | Alan Barrett  <> wrote:

  | >I think posix mode is on by default in NetBSD ksh, but that's
  | >irrelevant to this problem.

  | Sure, just do what you propose then.

I also agree that what you're doing to ksh is correct.

And that most probably the place where the problem was detected
should be converted the the $( ) form - though I'm by no means an
advocate of never using the older ` ` form - where it works and doesn't
cause problems, use the old way, it makes the code work on more versions
of sh(1) (like the really old ones.)

And also, once all that is done, get rid of the unnecessary enclosing
quotes that, had they not been present, would have hidden the problem in
the first place.

That is, instead of
        var="`command with \"string\" arg`"
just do
        var=`command with "string" arg`
(using either the ` ` or the $( ) form of command subst)
and everyone is happy - including users of broken versions of ksh
(and any other shell whose author decided they needed to be compatible
with that one.)

The outer quotes aren't needed here, accomplish nothing, and may just as well
be removed.


Home | Main Index | Thread Index | Old Index