NetBSD-Bugs archive

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

Re: bin/50827 (sh -c ': "${x=$((1))}"' gives bogus syntax error)

The following reply was made to PR bin/50827; it has been noted by GNATS.

From: Robert Elz <kre%munnari.OZ.AU@localhost>
Subject: Re: bin/50827 (sh -c ': "${x=$((1))}"' gives bogus syntax error)
Date: Fri, 19 Feb 2016 21:49:24 +0700

     Date:        Fri, 19 Feb 2016 14:02:00 +0000 (UTC)
     Message-ID:  <>
   | christos committed a fix, does it work for you?
 I know this was not directed at me, so don't take this as an answer,
 but it still fails on even more bizarre usages...
 	./sh -c 'echo ${x:-$(( ${y:-"$((4))"} ))}'
 	sh: Syntax error: Unterminated quoted string
 this fails if the quotes are inside the outer $(( )), but not inside the
 inner $(( )) .. doesn't matter if the entire ${y...} is quoted or just
 as shown, it fails the same way.   But works if it is just the "4" quoted.
 And to go even further into the absurd ...
 	./sh -c 'echo ${x:-"$(( "${y:-$(( ${z:-$(( 9 ))} ))}" ))"}'
 	sh: Syntax error: Missing '))'
 sh is better now than it was, but this stuff ought to be fixed as well.
 Without quoting, that works (believe it or not.)
 I am looking into it, but maybe the PR can remain open for now.

Home | Main Index | Thread Index | Old Index