Re: [preliminary patch] test -v VARNAME

2017-03-25 Thread Martijn Dekker
Op 26-03-17 om 01:40 schreef Thorsten Glaser: > Martijn Dekker dixit: > >> This patch adds a unary -v operator to test/[/[[ to check if a variable >> is set, like in ksh93, bash and zsh. > > Eh? Isn’t that the same as [[ -n ${var+x} ]] ? Yes. Advantage being that -v allows testing a variable nam

Re: [preliminary patch] test -v VARNAME

2017-03-25 Thread Thorsten Glaser
Martijn Dekker dixit: >This patch adds a unary -v operator to test/[/[[ to check if a variable >is set, like in ksh93, bash and zsh. Eh? Isn’t that the same as [[ -n ${var+x} ]] ? >The one thing I haven't got working is > > foo[2]=bar > [[ -v foo[2] ]] > >I haven't figured out how to get it

[preliminary patch] test -v VARNAME

2017-03-25 Thread Martijn Dekker
This patch adds a unary -v operator to test/[/[[ to check if a variable is set, like in ksh93, bash and zsh. I don't know if I've done this right. All I can say is it works for me. The one thing I haven't got working is foo[2]=bar [[ -v foo[2] ]] I haven't figured out how to get it to par