Debian Bug Tracking System wrote:
>> This operation fails on Ubuntu:
>>
>>     $ /bin/sh -c 'if false; then d="${foo/bar}"; fi'
>>     /bin/sh: Syntax error: Bad substitution
>>
>> When used with other POSIX shells it succeeds. While semantically the 
>> variable reference ${foo/bar} is not valid, this is not a syntax error 
>> according to POSIX, and since the variable assignment expression is 
>> never invoked (because it's within an "if false") it should not be seen 
>> as an error.
> 
> Hmm, you'll find that bash does exactly the same thing for
> expansions that it doesn't recognise:
> 
> $ bash -c 'echo ${aj!3}; echo hi'
> bash: ${aj!3}: bad substitution
> $
> 
> Since the expansion of '/' is not defined by POSIX, dash is
> certainly within its rights to abort rather than fail silently.

Absolutely. I think you've missed the point though: dash is complaining
about a syntax error, when in fact it is not one. If it had simply said
(as bash does in your example), "bad substitution", I think Paul
would've had no complaints.

-- 
Micah J. Cowan
Programmer, musician, typesetting enthusiast, gamer...
http://micah.cowan.name/




-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to