Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15260 > unrolled thread

x[

Started byIsabella Bosia <izaberina@gmail.com>
First post2019-07-29 17:55 +0100
Last post2019-07-29 18:53 +0100
Articles 2 — 2 participants

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.


Contents

  x[ Isabella Bosia <izaberina@gmail.com> - 2019-07-29 17:55 +0100
    Re: x[ Stephane Chazelas <stephane.chazelas@gmail.com> - 2019-07-29 18:53 +0100

#15260 — x[

FromIsabella Bosia <izaberina@gmail.com>
Date2019-07-29 17:55 +0100
Subjectx[
Message-ID<mailman.158.1564419372.1985.bug-bash@gnu.org>
haven't really looked into why this happens but x[ seems to trigger some
funny parser behavior

x[ newline     should not prompt with PS2

it can't be defined as a normal sh function, but it can be defined with the
function keyword

it can't be called like a normal function, but things like "x[" or \x[ work

this bug seems old

[toc] | [next] | [standalone]


#15264

FromStephane Chazelas <stephane.chazelas@gmail.com>
Date2019-07-29 18:53 +0100
Message-ID<mailman.173.1564422827.1985.bug-bash@gnu.org>
In reply to#15260
2019-07-29 17:55:58 +0100, Isabella Bosia:
> haven't really looked into why this happens but x[ seems to trigger some
> funny parser behavior
> 
> x[ newline     should not prompt with PS2
> 
> it can't be defined as a normal sh function, but it can be defined with the
> function keyword
[...]

x[ is the start of an array element assignment. newline is valid (just a token
separator like space) inside an arithmetic expression.

$ x[
> 1
> +
> 1
> ]=3
$ typeset -p x
declare -a x=([2]="3")

You'll notice:

$ +[
+[: command not found
$ 'x'[
x[: command not found

-- 
Stephane

[toc] | [prev] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web