summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authorChet Ramey <chet.ramey@case.edu>2018-12-20 11:41:58 -0500
committerChet Ramey <chet.ramey@case.edu>2018-12-20 11:41:58 -0500
commitf250956cb2a8dca13fc0242affc225f9d6983604 (patch)
tree2df8e15963af786dc8efed1c91c4d823a3bf05bb /parse.y
parent2ae59c1134a75d5778997b7202b15b0586283042 (diff)
downloadbash-5.0-testing.tar.gz
bash-5.0-rc1 releasebash-5.0-rc1bash-5.0-testing
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y17
1 files changed, 16 insertions, 1 deletions
diff --git a/parse.y b/parse.y
index 4747408e..3e100fca 100644
--- a/parse.y
+++ b/parse.y
@@ -418,7 +418,8 @@ inputunit: simple_list simple_list_terminator
/* EOF after an error. Do ignoreeof or not. Really
only interesting in non-interactive shells */
global_command = (COMMAND *)NULL;
- last_command_exit_value = 1;
+ if (last_command_exit_value == 0)
+ last_command_exit_value = EX_BADUSAGE; /* force error return */
handle_eof_input_unit ();
if (interactive && parse_and_execute_level == 0)
{
@@ -894,6 +895,16 @@ select_command: SELECT WORD newline_list DO list DONE
$$ = make_select_command ($2, REVERSE_LIST ($5, WORD_LIST *), $9, word_lineno[word_top]);
if (word_top > 0) word_top--;
}
+ | SELECT WORD newline_list IN list_terminator newline_list DO compound_list DONE
+ {
+ $$ = make_select_command ($2, (WORD_LIST *)NULL, $8, word_lineno[word_top]);
+ if (word_top > 0) word_top--;
+ }
+ | SELECT WORD newline_list IN list_terminator newline_list '{' compound_list '}'
+ {
+ $$ = make_select_command ($2, (WORD_LIST *)NULL, $8, word_lineno[word_top]);
+ if (word_top > 0) word_top--;
+ }
;
case_command: CASE WORD newline_list IN newline_list ESAC
@@ -3020,7 +3031,11 @@ special_case_tokens (tokstr)
{
/* Posix grammar rule 6 */
if ((last_read_token == WORD) &&
+#if defined (SELECT_COMMAND)
((token_before_that == FOR) || (token_before_that == CASE) || (token_before_that == SELECT)) &&
+#else
+ ((token_before_that == FOR) || (token_before_that == CASE)) &&
+#endif
(tokstr[0] == 'i' && tokstr[1] == 'n' && tokstr[2] == 0))
{
if (token_before_that == CASE)