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


Groups > gnu.bash.bug > #15264

Re: x[

From Stephane Chazelas <stephane.chazelas@gmail.com>
Newsgroups gnu.bash.bug
Subject Re: x[
Date 2019-07-29 18:53 +0100
Message-ID <mailman.173.1564422827.1985.bug-bash@gnu.org> (permalink)
References <CAAZkfoK2hYq_qSkdKYc1on=+V4VEBgpgZW96sYNZwC+AMw7iTw@mail.gmail.com> <mailman.158.1564419372.1985.bug-bash@gnu.org> <20190729175338.ewjhkqxcmnm3q3km@chaz.gmail.com>

Show all headers | View raw


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

Back to gnu.bash.bug | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

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

csiph-web