[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: portability of ${foo:+bar}
From: |
Paul Eggert |
Subject: |
Re: portability of ${foo:+bar} |
Date: |
Tue, 08 Nov 2005 13:32:07 -0800 |
User-agent: |
Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) |
Ralf Wildenhues <address@hidden> writes:
> Quoting autoconf.info:
>
> | `${VAR:-VALUE}'
> | Old BSD shells, including the Ultrix `sh', don't accept the colon
> | for any shell substitution, and complain and die.
>
> Can I assume that any shell on a system, which has shared libraries,
> understands `${foo:+bar}' and `${foo:-bar}' correctly, even if bar
> happens to be `:'?
Ultrix had shared libraries, I think; so the answer would probably be
'no' if you want to port to old Ultrix hosts. However these old hosts
are becoming pretty rare these days; I'm not sure they're worth
worrying about.
> Rationale: it makes avoiding a stray colon in colon-separated variables
> sooo much easier,
In some cases ${foo+bar} and ${foo-bar} suffice; that's portable.