Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #14972 > unrolled thread
| Started by | Martijn Dekker <martijn@inlv.org> |
|---|---|
| First post | 2018-12-27 22:11 +0100 |
| Last post | 2018-12-27 22:11 +0100 |
| Articles | 1 — 1 participant |
Back to article view | Back to gnu.bash.bug
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Should [[ -v 1 ]] be supported? Martijn Dekker <martijn@inlv.org> - 2018-12-27 22:11 +0100
| From | Martijn Dekker <martijn@inlv.org> |
|---|---|
| Date | 2018-12-27 22:11 +0100 |
| Subject | Re: Should [[ -v 1 ]] be supported? |
| Message-ID | <mailman.6411.1545945540.1284.bug-bash@gnu.org> |
Op 27-12-18 om 19:22 schreef Chet Ramey:
> On 12/26/18 10:49 PM, Peng Yu wrote:
>
>> Although [[ -z ${1+s} ]] and (($#)) works for testing if $1 is set,
>> neither of them are uniformly better performance wise. In this case,
>> should [[ -v 1 ]] be supported?
>
> So you're saying that neither of the existing options performs better
> than the other, though they both perform well, so we should add some
> new capability just because? That's a particularly poor argument.
Consistency might be a better argument. If [[ -v foo ]] is equivalent to
[[ -n ${foo+s} ]] for variables (with the advantage that you don't need
'eval' to handle arbitrary values of 'foo'), then perhaps it's not
unreasonable to expect [[ -v 1 ]] to be equivalent to [[ -n ${1+s} ]].
FWIW, zsh and mksh do support this; ksh93 doesn't.
- M.
Back to top | Article view | gnu.bash.bug
csiph-web