Closed riacataquian closed 1 year ago
the parser already supports the select command but the interpreter treats it just like any other for command
select
for
given the syntax:
select name [in words ...]; do commands; done
fix support by:
in
REPLY
PS3
#?
additionally, select should loop until an input is provided. in case of an invalid input, the name will be empty
$ bash -c 'PS3="pick one: "; select SEL in foo; do echo $REPLY; break; done' 1) foo pick one: 1) foo pick one: 1) foo pick one: 1
fixes https://github.com/mvdan/sh/issues/969
the parser already supports the
select
command but the interpreter treats it just like any otherfor
commandgiven the syntax:
fix support by:
in
, to generate a list of items, each preceeded by a number and a close parenthesisREPLY
PS3
, another special variable in Bash, which can be set to the prompt while the shell awaits for input. if not provided, defaults to#?
:additionally,
select
should loop until an input is provided. in case of an invalid input, the name will be emptyfixes https://github.com/mvdan/sh/issues/969