On Wed, May 09, 2007 at 01:22:33PM -0400, Doug Goldstein wrote:
> In short the issue is with variables used on the same lines....
>
> example:
>
> unset A B; A="moo" B="$A more"; echo $A , $B
Thanks for the report!
This had previously been reported by Debian as well. I apologise
for the delay in responding to this.
First of all I've looked at the POSIX specification and there is no
requirement for this behaviour. Neither is there a requirement for
the shell to behave in the way that dash does.
This means that both bash and dash are compliant in this respect.
Now I have considered changing dash's behaviour to match that of
bash. However, in doing so I found that bash's behaviour is in
fact quite inconsistent with itself. For example,
$ bash -c 'K=dvb0.net0 A=${K#dvb} eval echo \$A'
$ bash -c 'a=/bin PATH=$a ls /dev/null'
bash: line 1: ls: No such file or directory
$ bash -c 'x=${K:=dvb0.net0} A=${K#dvb} echo $A'
$
As you can see, whether the first assignment affects a second
assignment is qutie haphazard within bash.
On the other the behaviour of dash is self-consistent, the effect
of the assignment is not realised until after parameter expansions
have all completed.
Therefore I've concluded that scripts cannot safely rely on this
behaviour and thus there is no clear benefit in changing dash's
behaviour at this time.
Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]