Re: Quoted closing brace in variable default expansion

2010-11-20 Thread Cristian Ionescu-Idbohrn
On Sat, 20 Nov 2010, Harald van Dijk wrote: > On 19/11/10 14:53, Herbert Xu wrote: > > Harald van Dijk wrote: > > >sh -c 'echo "${x:-\}}"' > > > > If you need to print anything involving a backspace you should > > use printf and not echo. > > It's true that backslashes should not be passed to

Re: Quoted closing brace in variable default expansion

2010-11-20 Thread Harald van Dijk
On 19/11/10 14:53, Herbert Xu wrote: Harald van Dijk wrote: sh -c 'echo "${x:-\}}"' If you need to print anything involving a backspace you should use printf and not echo. It's true that backslashes should not be passed to echo, but assuming unset or empty x, "${x:-\}}" should expand to

Re: Quoted closing brace in variable default expansion

2010-11-19 Thread Herbert Xu
Harald van Dijk wrote: > > Thanks, that helps to clarify. Unfortunately, the valid alternative > given there: > > sh -c 'echo "${x:-\}}"' > > seemingly incorrectly prints \} with dash and with bash, so that is a > non-option at this time for me. If you need to print anything involving a bac

Re: Quoted closing brace in variable default expansion

2010-11-13 Thread Jilles Tjoelker
On Sat, Nov 13, 2010 at 10:41:47AM -0600, Jonathan Nieder wrote: > Harald van Dijk wrote: > > $ ksh -c 'echo "${x:-"}"}"' > > } > > $ dash -c 'echo "${x:-"}"}"' > > dash: 1: Syntax error: Unterminated quoted string > > $ busybox sh -c 'echo "${x:-"}"}"' > > sh: syntax error: unterminat

Re: Quoted closing brace in variable default expansion

2010-11-13 Thread Harald van Dijk
On 13/11/10 17:41, Jonathan Nieder wrote: Harald van Dijk wrote: $ dash -c 'echo "${x:-"}"}"' dash: 1: Syntax error: Unterminated quoted string http://austingroupbugs.net/view.php?id=221 note #399 Thanks, that helps to clarify. Unfortunately, the valid alternative given there:

Re: Quoted closing brace in variable default expansion

2010-11-13 Thread Jonathan Nieder
Hi Herald, Harald van Dijk wrote: > $ ksh -c 'echo "${x:-"}"}"' > } > $ dash -c 'echo "${x:-"}"}"' > dash: 1: Syntax error: Unterminated quoted string > $ busybox sh -c 'echo "${x:-"}"}"' > sh: syntax error: unterminated quoted string > > It looks like dash and other ash derivatives

Quoted closing brace in variable default expansion

2010-11-13 Thread Harald van Dijk
Hi all, It's probably best to start with the example: $ bash -c 'echo "${x:-"}"}"' } $ ksh -c 'echo "${x:-"}"}"' } $ dash -c 'echo "${x:-"}"}"' dash: 1: Syntax error: Unterminated quoted string $ busybox sh -c 'echo "${x:-"}"}"' sh: syntax error: unterminated quoted string It lo