nmh-workers
[Top][All Lists]
Advanced

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

Re: [Nmh-workers] Portability issues in nmh 1.5-RC2


From: David Levine
Subject: Re: [Nmh-workers] Portability issues in nmh 1.5-RC2
Date: Tue, 08 May 2012 21:29:17 -0400

Valdis wrote:

> On Mon, 07 May 2012 23:23:12 -0400, David Levine said:
> 
> > I had tried dash first.  It caught a few things but not as much
> > as heirloom-sh.
> 
> OK, I'll bite. It caught a few things, or it broke a few things?

I guess that depends on how you look at it.  Anyway,
I'll start a list in test/README:

- Use `` instead of $().

- Wrap shell variables with "" if they could possibly contain
  whitespace or special characters that would affect syntax.

- Use the arith_eval() function in common.sh instead of $(()) or expr.
  It detects at run time if $(()) is available.

- Use grep >/dev/null instead of grep -q.

- Don't use egrep, grep -E, fgrep, grep -F, or other non-portable grep
  functionality.  The built-in case statement supports alternation (|).

- Don't use ! to negate conditions.  Instead, use something like:
    <condition> || <statement>
  or
    if <condition>; then :; else <statements> fi

- Separate variable assignment from export (don't assign in export
  statements).

- Use sed >tmpfile and mv instead of sed -i.

- Avoid depending on the exact format of output from system (non-nmh)
  programs.

David



reply via email to

[Prev in Thread] Current Thread [Next in Thread]