===== CASE: -n -c FOO=1 break ===== FOO=1 break ^~~~ [ -c flag ]:1: Control flow shouldn't have environment bindings ===== CASE: -n -c break 1 2 ===== break 1 2 ^ [ -c flag ]:1: Unexpected argument to 'break' ===== CASE: -n -c x"y"() { echo hi; } ===== x"y"() { echo hi; } ^ [ -c flag ]:1: Invalid function name ===== CASE: -n -c function x"y" { echo hi; } ===== function x"y" { echo hi; } ^ [ -c flag ]:1: Invalid KSH-style function name ===== CASE: -n -c } ===== } ^ [ -c flag ]:1: Unexpected right brace ===== CASE: -n -c case foo in *) echo ===== case foo in *) echo ^ [ -c flag ]:1: Expected ;; or esac ===== CASE: -n -c case foo in x|) echo ===== case foo in x|) echo ^ [ -c flag ]:1: Expected case pattern ===== CASE: -n -c ls foo| ===== ls foo| ^ [ -c flag ]:1: Unexpected EOF while parsing command ===== CASE: -n -c ls foo&& ===== ls foo&& ^ [ -c flag ]:1: Unexpected EOF while parsing command ===== CASE: -n -c foo() ===== foo() ^ [ -c flag ]:1: Unexpected word while parsing compound command ===== CASE: -n -c break >out ===== (command.ControlFlow keyword:) ===== CASE: -n -c break >out ===== break >out ^~~~~ [ -c flag ]:1: Control flow shouldn't have redirects ===== CASE: -n -c [ ( x ] ===== [ ( x ] ^ [ -c flag ]:1: Syntax error in expression (near Id.Op_RBracket) ===== CASE: -n -c PYTHONPATH=. FOO=(1 2) python ===== PYTHONPATH=. FOO=(1 2) python ^~~~ [ -c flag ]:1: Environment bindings can't contain array literals ===== CASE: -n -c PYTHONPATH+=1 python ===== PYTHONPATH+=1 python ^~~~~~~~~~~~ [ -c flag ]:1: Expected = in environment binding, got += ===== CASE: -n -c =var ===== =var ^ [ -c flag ]:1: =word isn't allowed. Hint: add a space after =, or quote it ===== CASE: -n -c =f(x) ===== =f(x) ^ [ -c flag ]:1: =word isn't allowed. Hint: add a space after =, or quote it ===== CASE: -n -c =var ===== =var ^ [ -c flag ]:1: =word isn't allowed. Hint: add a space after =, or quote it ===== CASE: -n -c =f(x) ===== =f(x) ^ [ -c flag ]:1: =word isn't allowed. Hint: add a space after =, or quote it ===== CASE: -n -c echo line 2 echo $( echo ===== echo $( echo ^ [ -c flag ]:3: Invalid word while parsing command list ===== CASE: -n -c echo line 2 echo ` echo ===== echo ` echo ^ [ -c flag ]:3: Unexpected EOF while looking for closing backtick ===== CASE: -n -c echo line 2 echo ` echo \` ===== echo ` echo \` ^ [ -c flag ]:3: Unexpected EOF while looking for closing backtick ===== CASE: -n -c echo line 2 echo ` echo \`unclosed ` ===== echo ` echo \`unclosed ` ^ [ backticks in [ -c flag ] ]:3: Unexpected EOF while looking for closing backtick ===== CASE: -n -c echo `for x in` ===== echo `for x in` ^ [ backticks in [ -c flag ] ]:1: Invalid word in for loop ===== CASE: -n -c echo < << ===== echo < << ^~ [ -c flag ]:1: Invalid token after redirect operator ===== CASE: -n -c echo $( echo > >> ) ===== echo $( echo > >> ) ^~ [ -c flag ]:1: Invalid token after redirect operator ===== CASE: -n -c cat < arms: [ (IfArm keyword: cond: (condition.Shell commands: [ (command.Simple blame_tok: <"true"> more_env: [] words: [{<"true">}] redirects: [] do_fork: T ) ] ) then_kw: action: [] spids: [2 8] ) ] else_action: [] fi_kw: redirects: [] ) ===== CASE: -n -c while false do done ===== (command.WhileUntil keyword: cond: (condition.Shell commands: [ (command.Simple blame_tok: <"false"> more_env: [] words: [{<"false">}] redirects: [] do_fork: T ) ] ) body: (command.DoGroup left: children:[] right:) redirects: [] ) ===== CASE: -n -c while true; false do done ===== (command.WhileUntil keyword: cond: (condition.Shell commands: [ (command.Sentence child: (command.Simple blame_tok: <"true"> more_env: [] words: [{<"true">}] redirects: [] do_fork: T ) terminator: ) (command.Simple blame_tok: <"false"> more_env: [] words: [{<"false">}] redirects: [] do_fork: T ) ] ) body: (command.DoGroup left: children:[] right:) redirects: [] ) ===== CASE: -n -c if true then fi ===== (command.If if_kw: arms: [ (IfArm keyword: cond: (condition.Shell commands: [ (command.Simple blame_tok: <"true"> more_env: [] words: [{<"true">}] redirects: [] do_fork: T ) ] ) then_kw: action: [] spids: [2 7] ) ] else_action: [] fi_kw: redirects: [] ) ===== CASE: -n -c while true; false do done ===== (command.WhileUntil keyword: cond: (condition.Shell commands: [ (command.Sentence child: (command.Simple blame_tok: <"true"> more_env: [] words: [{<"true">}] redirects: [] do_fork: T ) terminator: ) (command.Simple blame_tok: <"false"> more_env: [] words: [{<"false">}] redirects: [] do_fork: T ) ] ) body: (command.DoGroup left: children:[] right:) redirects: [] ) ===== CASE: -n -c echo ${ ===== echo ${ ^ [ -c flag ]:1: Unexpected token in ${} ===== CASE: -n -c ${foo:} ===== ${foo:} ^ [ -c flag ]:1: Token can't be used in prefix position ===== CASE: -n -c echo ${a[@Z ===== echo ${a[@Z ^ [ -c flag ]:1: Expected ] to close subscript ===== CASE: -n -c echo ${x.} ===== echo ${x.} ^ [ -c flag ]:1: Expected } to close ${ ===== CASE: -n -c echo ${!x.} ===== echo ${!x.} ^ [ -c flag ]:1: Expected } to close ${ ===== CASE: -n -c echo ${a:1;} ===== echo ${a:1;} ^ [ -c flag ]:1: Expected : or } in slice ===== CASE: -n -c echo ${a:1:2;} ===== echo ${a:1:2;} ^ [ -c flag ]:1: Unexpected token after arithmetic expression (Id.Arith_Semi != Id.Arith_RBrace) ===== CASE: -n -c echo ${#a. ===== echo ${#a. ^ [ -c flag ]:1: Expected } after length expression ===== CASE: -n -c for (( i = 0; i < 10; i++ ; ===== for (( i = 0; i < 10; i++ ; ^ [ -c flag ]:1: Unexpected token after arithmetic expression (Id.Arith_Semi != Id.Arith_RParen) ===== CASE: -n -c for (( i = 0; i < 10; i++ / ===== for (( i = 0; i < 10; i++ / ^ [ -c flag ]:1: Unexpected end of input ===== CASE: -n -c echo @(extglob|foo ===== echo @(extglob|foo ^~ [ -c flag ]:1: Unexpected EOF reading extended glob that began here ===== CASE: -n -c ${undef:- ===== ${undef:- ^ [ -c flag ]:1: Expected } to close ${ ===== CASE: -n -c ${undef:-$ ===== ${undef:-$ ^ [ -c flag ]:1: Expected } to close ${ ===== CASE: -n -c ${undef:-$F ===== ${undef:-$F ^ [ -c flag ]:1: Expected } to close ${ ===== CASE: -n -c ${x@ ===== ${x@ ^ [ -c flag ]:1: Unexpected token in ${} (VOp3) ===== CASE: -n -c ${x@Q ===== ${x@Q ^ [ -c flag ]:1: Expected } to close ${ ===== CASE: -n -c ${x% ===== ${x% ^ [ -c flag ]:1: Expected } to close ${ ===== CASE: -n -c ${x/ ===== ${x/ ^ [ -c flag ]:1: Expected } after replacement string, got Id.Eof_Real ===== CASE: -n -c ${x/a/ ===== ${x/a/ ^ [ -c flag ]:1: Expected } after replacement string, got Id.Eof_Real ===== CASE: -n -c ${x/a/b ===== ${x/a/b ^ [ -c flag ]:1: Expected } after replacement string, got Id.Eof_Real ===== CASE: -n -c ${x: ===== ${x: ^ [ -c flag ]:1: Unexpected end of input ===== CASE: -n -c a=(1 & 2) ===== a=(1 & 2) ^ [ -c flag ]:1: Unexpected token in array literal ===== CASE: -n -c a= (1 2) ===== a= (1 2) ^ [ -c flag ]:1: Expected ( after = ===== CASE: -n -c a=(1 2 ===== a=(1 2 ^ [ -c flag ]:1: Unexpected token in array literal ===== CASE: -n -c a=(1 ${2@} ) ===== a=(1 ${2@} ) ^ [ -c flag ]:1: Unexpected token in ${} (VOp3) ===== CASE: -n -c echo ${x/} ===== (command.Simple blame_tok: more_env: [] words: [ {} { (BracedVarSub left: token: var_name: x suffix_op: (suffix_op.PatSub pat: {} replace: (rhs_word__Empty) replace_mode: Id.Undefined_Tok slash_tok: ) right: ) } ] redirects: [] do_fork: T ) ===== CASE: -n -c echo ${x//} ===== (command.Simple blame_tok: more_env: [] words: [ {} { (BracedVarSub left: token: var_name: x suffix_op: (suffix_op.PatSub pat: {} replace: (rhs_word__Empty) replace_mode: Id.Lit_Slash slash_tok: ) right: ) } ] redirects: [] do_fork: T ) ===== CASE: -n -c echo ${x/foo} ===== (command.Simple blame_tok: more_env: [] words: [ {} { (BracedVarSub left: token: var_name: x suffix_op: (suffix_op.PatSub pat: {} replace: (rhs_word__Empty) replace_mode: Id.Undefined_Tok slash_tok: ) right: ) } ] redirects: [] do_fork: T ) ===== CASE: -n -c echo ${x//foo} ===== (command.Simple blame_tok: more_env: [] words: [ {} { (BracedVarSub left: token: var_name: x suffix_op: (suffix_op.PatSub pat: {} replace: (rhs_word__Empty) replace_mode: Id.Lit_Slash slash_tok: ) right: ) } ] redirects: [] do_fork: T ) ===== CASE: -n -c echo ${x/%foo} ===== (command.Simple blame_tok: more_env: [] words: [ {} { (BracedVarSub left: token: var_name: x suffix_op: (suffix_op.PatSub pat: {} replace: (rhs_word__Empty) replace_mode: Id.Lit_Percent slash_tok: ) right: ) } ] redirects: [] do_fork: T ) ===== CASE: -n -c echo ${x///foo} ===== (command.Simple blame_tok: more_env: [] words: [ {} { (BracedVarSub left: token: var_name: x suffix_op: (suffix_op.PatSub pat: { } replace: (rhs_word__Empty) replace_mode: Id.Lit_Slash slash_tok: ) right: ) } ] redirects: [] do_fork: T ) ===== CASE: -n -c echo ${x///} ===== (command.Simple blame_tok: more_env: [] words: [ {} { (BracedVarSub left: token: var_name: x suffix_op: (suffix_op.PatSub pat: {} replace: (rhs_word__Empty) replace_mode: Id.Lit_Slash slash_tok: ) right: ) } ] redirects: [] do_fork: T ) ===== CASE: -n -c echo ${x/%/} ===== (command.Simple blame_tok: more_env: [] words: [ {} { (BracedVarSub left: token: var_name: x suffix_op: (suffix_op.PatSub pat: {} replace: {} replace_mode: Id.Lit_Percent slash_tok: ) right: ) } ] redirects: [] do_fork: T ) ===== CASE: -n -c echo ${x////} ===== (command.Simple blame_tok: more_env: [] words: [ {} { (BracedVarSub left: token: var_name: x suffix_op: (suffix_op.PatSub pat: {} replace: {} replace_mode: Id.Lit_Slash slash_tok: ) right: ) } ] redirects: [] do_fork: T ) ===== CASE: -n -c echo ${x/%//} ===== (command.Simple blame_tok: more_env: [] words: [ {} { (BracedVarSub left: token: var_name: x suffix_op: (suffix_op.PatSub pat: {} replace: {} replace_mode: Id.Lit_Percent slash_tok: ) right: ) } ] redirects: [] do_fork: T ) ===== CASE: -n -c echo ${x//foo/replace } ===== (command.Simple blame_tok: more_env: [] words: [ {} { (BracedVarSub left: token: var_name: x suffix_op: (suffix_op.PatSub pat: {} replace: {<"replace\n">} replace_mode: Id.Lit_Slash slash_tok: ) right: ) } ] redirects: [] do_fork: T ) ===== CASE: -n -c echo ${x//foo/replace$foo} ===== (command.Simple blame_tok: more_env: [] words: [ {} { (BracedVarSub left: token: var_name: x suffix_op: (suffix_op.PatSub pat: {} replace: { ($ Id.VSub_DollarName foo)} replace_mode: Id.Lit_Slash slash_tok: ) right: ) } ] redirects: [] do_fork: T ) ===== CASE: -n -c "unterminated double ===== "unterminated double ^ [ -c flag ]:1: Unexpected EOF reading double-quoted string that began here ===== CASE: -n -c 'unterminated single ===== 'unterminated single ^ [ -c flag ]:1: Unexpected EOF in single-quoted string that began here ===== CASE: -n -c "unterminated double multiline line 1 line 2 ===== "unterminated double multiline ^ [ -c flag ]:2: Unexpected EOF reading double-quoted string that began here ===== CASE: -n -c 'unterminated single multiline line 1 line 2 ===== 'unterminated single multiline ^ [ -c flag ]:2: Unexpected EOF in single-quoted string that began here ===== CASE: -n -c echo ${x*} ===== echo ${x*} ^ [ -c flag ]:1: Unexpected token in ${} (VOp3) ===== CASE: -n -c echo ${x@} ===== echo ${x@} ^ [ -c flag ]:1: Unexpected token in ${} (VOp3) ===== CASE: -n -c echo ${x.} ===== echo ${x.} ^ [ -c flag ]:1: Expected } to close ${ ===== CASE: -n -c echo $(( 1 + 2 ; ===== echo $(( 1 + 2 ; ^ [ -c flag ]:1: Unexpected token after arithmetic expression (Id.Arith_Semi != Id.Arith_RParen) ===== CASE: -n -c echo $(( 1 + 2 ); ===== echo $(( 1 + 2 ); ^ [ -c flag ]:1: Expected second ) to end arith sub ===== CASE: -n -c echo $(( ===== echo $(( ^ [ -c flag ]:1: Unexpected end of input ===== CASE: -n -c echo $(( 1 ===== echo $(( 1 ^ [ -c flag ]:1: Unexpected token after arithmetic expression (Id.Eof_Real != Id.Arith_RParen) ===== CASE: -n -c (( 1 + 2 / ===== (( 1 + 2 / ^ [ -c flag ]:1: Unexpected end of input ===== CASE: -n -c (( 1 + 2 )/ ===== (( 1 + 2 )/ ^ [ -c flag ]:1: Expected second ) to end arith statement ===== CASE: -n -c (( 1 ===== (( 1 ^ [ -c flag ]:1: Unexpected token after arithmetic expression (Id.Eof_Real != Id.Arith_RParen) ===== CASE: -n -c (( ===== (( ^ [ -c flag ]:1: Unexpected end of input ===== CASE: -n -c a[x+]=1 ===== a[x+]=1 ^ [ array LHS in [ -c flag ] ]:1: Unexpected end of input ===== CASE: -n -c a[]=1 ===== a[]=1 ^ [ array LHS in [ -c flag ] ]:1: Unexpected end of input ===== CASE: -n -c a[*]=1 ===== a[*]=1 ^ [ array LHS in [ -c flag ] ]:1: Token can't be used in prefix position ===== CASE: -n -c (( a + { )) ===== (( a + { )) ^ [ -c flag ]:1: Unexpected token while parsing arithmetic: '{' ===== CASE: -n -c (( a + } )) ===== (( a + } )) ^ [ -c flag ]:1: Token can't be used in prefix position ===== CASE: -n -c echo $((a b)) ===== echo $((a b)) ^ [ -c flag ]:1: Unexpected token after arithmetic expression (Id.Word_Compound != Id.Arith_RParen) ===== CASE: -n -c ((a b)) ===== ((a b)) ^ [ -c flag ]:1: Unexpected token after arithmetic expression (Id.Word_Compound != Id.Arith_RParen) ===== CASE: -n -c for ((x=0; x<5; x++)); do echo $x; done ===== (command.ForExpr keyword: init: (arith_expr.BinaryAssign op_id: Id.Arith_Equal left: ($ Id.Lit_ArithVarLike x) right: {} ) cond: (arith_expr.Binary op_id: Id.Arith_Less left: ($ Id.Lit_ArithVarLike x) right: {} ) update: (arith_expr.UnaryAssign op_id:Id.Node_PostDPlus child:($ Id.Lit_ArithVarLike x)) body: (command.DoGroup left: children: [ (command.Sentence child: (command.Simple blame_tok: more_env: [] words: [{} {($ Id.VSub_DollarName x)}] redirects: [] do_fork: T ) terminator: ) ] right: ) redirects: [] ) ===== CASE: -n -c for ((; x<5; x++)); do echo $x; done ===== (command.ForExpr keyword: cond: (arith_expr.Binary op_id: Id.Arith_Less left: ($ Id.Lit_ArithVarLike x) right: {} ) update: (arith_expr.UnaryAssign op_id:Id.Node_PostDPlus child:($ Id.Lit_ArithVarLike x)) body: (command.DoGroup left: children: [ (command.Sentence child: (command.Simple blame_tok: more_env: [] words: [{} {($ Id.VSub_DollarName x)}] redirects: [] do_fork: T ) terminator: ) ] right: ) redirects: [] ) ===== CASE: -n -c for ((; ; x++)); do echo $x; done ===== (command.ForExpr keyword: update: (arith_expr.UnaryAssign op_id:Id.Node_PostDPlus child:($ Id.Lit_ArithVarLike x)) body: (command.DoGroup left: children: [ (command.Sentence child: (command.Simple blame_tok: more_env: [] words: [{} {($ Id.VSub_DollarName x)}] redirects: [] do_fork: T ) terminator: ) ] right: ) redirects: [] ) ===== CASE: -n -c for ((; ;)); do echo $x; done ===== (command.ForExpr keyword: body: (command.DoGroup left: children: [ (command.Sentence child: (command.Simple blame_tok: more_env: [] words: [{} {($ Id.VSub_DollarName x)}] redirects: [] do_fork: T ) terminator: ) ] right: ) redirects: [] ) ===== CASE: -n -c for ((x=0; x<5; x++ b)); do echo $x; done ===== for ((x=0; x<5; x++ b)); do echo $x; done ^ [ -c flag ]:1: Unexpected token after arithmetic expression (Id.Word_Compound != Id.Arith_RParen) ===== CASE: -n -c for ((x=0 b; x<5; x++)); do echo $x; done ===== for ((x=0 b; x<5; x++)); do echo $x; done ^ [ -c flag ]:1: Expected ; here ===== CASE: -n -c for ((x=0; x<5 b; x++)); do echo $x; done ===== for ((x=0; x<5 b; x++)); do echo $x; done ^ [ -c flag ]:1: Expected ; here ===== CASE: -n -c ${a:1+2 b} ===== ${a:1+2 b} ^ [ -c flag ]:1: Expected : or } in slice ===== CASE: -n -c ${a:1+2:3+4 b} ===== ${a:1+2:3+4 b} ^ [ -c flag ]:1: Unexpected token after arithmetic expression (Id.Word_Compound != Id.Arith_RBrace) ===== CASE: -n -c ${a[1+2 b]} ===== ${a[1+2 b]} ^ [ -c flag ]:1: Unexpected token after arithmetic expression (Id.Word_Compound != Id.Arith_RBracket) ===== CASE: -n -c $(( 1 + + )) ===== $(( 1 + + )) ^ [ -c flag ]:1: Token can't be used in prefix position ===== CASE: -n -c $(( 1 2 )) ===== $(( 1 2 )) ^ [ -c flag ]:1: Unexpected token after arithmetic expression (Id.Word_Compound != Id.Arith_RParen) ===== CASE: -n -c $(( - ; )) ===== $(( - ; )) ^ [ -c flag ]:1: Token can't be used in prefix position ===== CASE: -n -c $(( ` )) ===== $(( ` )) ^ [ -c flag ]:1: Unexpected EOF while looking for closing backtick ===== CASE: -n -c $(( $ )) ===== $(( $ )) ^ [ -c flag ]:1: Unexpected token while parsing arithmetic: '$' ===== CASE: -n -c $(( x+1 = 42 )) ===== $(( x+1 = 42 )) ^ [ -c flag ]:1: Left-hand side of this assignment is invalid ===== CASE: -n -c $(( (x+42)++ )) ===== $(( (x+42)++ )) ^~ [ -c flag ]:1: Left-hand side of this assignment is invalid ===== CASE: -n -c $(( ++(x+42) )) ===== $(( ++(x+42) )) ^~ [ -c flag ]:1: Left-hand side of this assignment is invalid ===== CASE: -n -c [[ a b ]] ===== [[ a b ]] ^ [ -c flag ]:1: Expected ]] ===== CASE: -n -c [[ a "a"$(echo hi)"b" ]] ===== [[ a "a"$(echo hi)"b" ]] ^ [ -c flag ]:1: Expected ]] ===== CASE: -n -c [[ a == ]] ===== [[ a == ]] ^ [ -c flag ]:1: Expected ]] ===== CASE: -n -c [[ ( 1 == 2 - ]] ===== [[ ( 1 == 2 - ]] ^ [ -c flag ]:1: Expected ), got word.Compound ===== CASE: -n -c [[ == ]] ===== [[ == ]] ^~ [ -c flag ]:1: Unexpected token in boolean expression (Id.BoolBinary_GlobDEqual) ===== CASE: -n -c [[ ) ]] ===== [[ ) ]] ^ [ -c flag ]:1: Unexpected token in boolean expression (Id.Op_RParen) ===== CASE: -n -c [[ ( ]] ===== [[ ( ]] ^~ [ -c flag ]:1: Unexpected token in boolean expression (Id.Lit_DRightBracket) ===== CASE: -n -c [[ ;;; ]] ===== [[ ;;; ]] ^~ [ -c flag ]:1: Unexpected token in boolean expression (Id.Op_DSemi) ===== CASE: -n -c [[ ===== [[ ^ [ -c flag ]:1: Unexpected token in boolean expression (Id.Eof_Real) ===== CASE: -n -c [[ ( a == b foo${var} ]] ===== [[ ( a == b foo${var} ]] ^~~ [ -c flag ]:1: Expected ), got word.Compound ===== CASE: [ x -a y f ] ===== [ x -a y f ] ^ [ -c flag ]:1: (test) Unexpected trailing word 'f' ===== CASE: test x -a y f ===== test x -a y f ^ [ -c flag ]:1: (test) Unexpected trailing word 'f' ===== CASE: [ x ===== [ x ^ [ -c flag ]:1: missing closing ] ===== CASE: [ x x ] ===== [ x x ] ^ [ -c flag ]:1: (test) Expected unary operator, got 'x' (2 args) ===== CASE: [ x x "a b" ] ===== [ x x "a b" ] ^ [ -c flag ]:1: (test) Expected binary operator, got 'x' (3 args) ===== CASE: [ -t xxx ] ===== [ -t xxx ] ^~~ [ -c flag ]:1: (test) Invalid file descriptor 'xxx' ===== CASE: [ \( x -a -y -a z ] ===== [??? no location ???] (test) Expected ), got EOF ===== CASE: printf % ===== % ^ [ printf word at line 1 of [ -c flag ] ]:1: Expected a printf format character ===== CASE: printf [%Z] ===== [%Z] ^ [ printf word at line 1 of [ -c flag ] ]:1: Invalid printf format character ===== CASE: printf -v "-invalid-" %s foo ===== -invalid- ^ [ dynamic LHS word at ? ]:1: Unexpected end of input printf -v "-invalid-" %s foo ^~~~~~ [ -c flag ]:1: 'printf' got invalid LHS expression ===== CASE: shift 1 2 ===== shift 1 2 ^~~~~ [ -c flag ]:1: 'shift' got too many arguments ===== CASE: shift zzz ===== shift zzz ^~~~~ [ -c flag ]:1: 'shift' Invalid shift argument 'zzz' ===== CASE: pushd x y ===== pushd x y ^ [ -c flag ]:1: 'pushd' got too many arguments ===== CASE: pwd -x ===== pwd -x ^~ [ -c flag ]:1: 'pwd' doesn't accept flag -x ===== CASE: pp x foo a-x ===== pp x foo a-x ^ [ -c flag ]:1: 'pp' got invalid action 'x' ===== CASE: wait zzz ===== wait zzz ^~~ [ -c flag ]:1: 'wait' expected PID or jobspec, got 'zzz' ===== CASE: wait %jobspec-not-supported ===== wait %jobspec-not-supported ^ [ -c flag ]:1: 'wait' expected PID or jobspec, got '%jobspec-not-supported' ===== CASE: unset invalid-var-name ===== unset invalid-var-name ^~~~~ [ -c flag ]:1: fatal: Invalid LHS to modify ===== CASE: getopts hc: invalid-var-name ===== getopts hc: invalid-var-name ^~ [ -c flag ]:1: 'getopts' got invalid variable name 'invalid-var-name' ===== CASE: read -x ===== read -x ^~ [ -c flag ]:1: 'read' doesn't accept flag -x ===== CASE: builtin read -x ===== builtin read -x ^~ [ -c flag ]:1: 'read' doesn't accept flag -x ===== CASE: read -n ===== read -n ^~ [ -c flag ]:1: 'read' expected argument to '-n' ===== CASE: read -n x ===== read -n x ^ [ -c flag ]:1: 'read' expected integer after -n, got 'x' ===== CASE: set -o errexit +o oops ===== set -o errexit +o oops ^~~ [ -c flag ]:1: 'set' got invalid option 'oops' osh usage error: got invalid argument 'x' to '-ast-format', expected one of: text|abbrev-text|html|abbrev-html|oheap|none oils: got invalid option 'oops' ===== CASE: -n -c echo {1..3..-1} ===== echo {1..3..-1} ^~~~~~~~ [ -c flag ]:1: Invalid step -1 for ascending integer range ===== CASE: -n -c echo {1..3..0} ===== echo {1..3..0} ^~~~~~~ [ -c flag ]:1: Step can't be 0 ===== CASE: -n -c echo {3..1..1} ===== echo {3..1..1} ^~~~~~~ [ -c flag ]:1: Invalid step 1 for descending integer range ===== CASE: -n -c echo {3..1..0} ===== echo {3..1..0} ^~~~~~~ [ -c flag ]:1: Step can't be 0 ===== CASE: -n -c echo {a..Z} ===== echo {a..Z} ^~~~ [ -c flag ]:1: Mismatched cases in character range ===== CASE: -n -c echo {a..z..0} ===== echo {a..z..0} ^~~~~~~ [ -c flag ]:1: Step can't be 0 ===== CASE: -n -c echo {a..z..-1} ===== echo {a..z..-1} ^~~~~~~~ [ -c flag ]:1: Invalid step -1 for ascending character range ===== CASE: -n -c echo {z..a..1} ===== echo {z..a..1} ^~~~~~~ [ -c flag ]:1: Invalid step 1 for descending character range ===== CASE: append ===== append ^~~~~~ [ -c flag ]:1: 'append' expected a List as a typed arg ===== CASE: append invalid- ===== append invalid- ^~~~~~ [ -c flag ]:1: 'append' expected a List as a typed arg test/parse-errors.sh: line 895: blocks: command not found test/parse-errors.sh: line 896: parse_brace: command not found test/parse-errors.sh: line 897: regex_literals: command not found test/parse-errors.sh: line 898: proc_sig: command not found test/parse-errors.sh: line 899: proc_arg_list: command not found test/parse-errors.sh: line 900: ysh_var: command not found test/parse-errors.sh: line 901: ysh_expr_more: command not found test/parse-errors.sh: line 902: ysh_hay_assign: command not found ===== CASE: -n -c echo $'\u{03bc' ===== (command.Simple blame_tok: more_env: [] words: [ {} { (SingleQuoted left: tokens: [ ] right: ) } ] redirects: [] do_fork: T ) ===== CASE: +O parse_backslash -n -c echo parse_backslash $'\u{03bc' ===== echo parse_backslash $'\u{03bc' ^ [ -c flag ]:1: Invalid char escape in C-style string literal ===== CASE: -n -c const bad = $'\u{03bc' ===== const bad = $'\u{03bc' ^ [ -c flag ]:1: Invalid char escape in C-style string literal ===== CASE: -n -c echo $'\z' ===== (command.Simple blame_tok: more_env: [] words: [ {} { (SingleQuoted left: tokens: [ ] right: ) } ] redirects: [] do_fork: T ) ===== CASE: -n -c const bad = $'\z' ===== const bad = $'\z' ^ [ -c flag ]:1: Invalid char escape in C-style string literal ===== CASE: -n -c echo $'\101' ===== (command.Simple blame_tok: more_env: [] words: [ {} { (SingleQuoted left: tokens: [] right: ) } ] redirects: [] do_fork: T ) ===== CASE: -n -c const bad = $'\101' ===== const bad = $'\101' ^~~~ [ -c flag ]:1: Use \xhh or \u{...} instead of octal escapes in YSH strings ===== CASE: -n -c const bad = c'\xf' ===== const bad = c'\xf' ^ [ -c flag ]:1: Syntax error in expression (near Id.Left_SingleQuote) ===== CASE: -n -c echo "\z" ===== (command.Simple blame_tok: more_env: [] words: [{} {(DQ )}] redirects: [] do_fork: T ) ===== CASE: +O parse_backslash -n -c echo parse_backslash "\z" ===== echo parse_backslash "\z" ^ [ -c flag ]:1: Invalid char escape in double quoted string ===== CASE: -n -c echo "\z" ===== echo "\z" ^ [ -c flag ]:1: Invalid char escape in double quoted string ===== CASE: -n -c const bad = "\z" ===== const bad = "\z" ^ [ -c flag ]:1: Invalid char escape in double quoted string ===== CASE: -n -c echo "\u1234" ===== (command.Simple blame_tok: more_env: [] words: [{} {(DQ )}] redirects: [] do_fork: T ) ===== CASE: -n -c echo "\u1234" ===== echo "\u1234" ^ [ -c flag ]:1: Invalid char escape in double quoted string ===== CASE: -n -c const bad = "\u1234" ===== const bad = "\u1234" ^ [ -c flag ]:1: Invalid char escape in double quoted string ===== CASE: -n -c echo "`echo hi`" ===== (command.Simple blame_tok: more_env: [] words: [ {} { (DQ (CommandSub left_token: child: (command.Simple blame_tok: more_env: [] words: [{} {}] redirects: [] do_fork: T ) right: ) ) } ] redirects: [] do_fork: T ) ===== CASE: -n -c echo "`echo hi`" ===== echo "`echo hi`" ^ [ -c flag ]:1: Use $(cmd) instead of backticks (parse_backticks) ===== CASE: -n -c const bad = "`echo hi`" ===== const bad = "`echo hi`" ^ [ -c flag ]:1: Invalid backtick: use $(cmd) or \` in YSH strings ===== CASE: -n -c setvar x = "\z" ===== setvar x = "\z" ^ [ -c flag ]:1: Invalid char escape in double quoted string ===== CASE: -n -c setvar x = $'\z' ===== setvar x = $'\z' ^ [ -c flag ]:1: Invalid char escape in C-style string literal ===== CASE: -n -c echo `echo hi` ===== (command.Simple blame_tok: more_env: [] words: [ {} { (CommandSub left_token: child: (command.Simple blame_tok: more_env: [] words: [{} {}] redirects: [] do_fork: T ) right: ) } ] redirects: [] do_fork: T ) ===== CASE: -n -c echo "foo = `echo hi`" ===== (command.Simple blame_tok: more_env: [] words: [ {} { (DQ <"foo = "> (CommandSub left_token: child: (command.Simple blame_tok: more_env: [] words: [{} {}] redirects: [] do_fork: T ) right: ) ) } ] redirects: [] do_fork: T ) ===== CASE: +O parse_backticks -n -c echo `echo hi` ===== echo `echo hi` ^ [ -c flag ]:1: Use $(cmd) instead of backticks (parse_backticks) ===== CASE: +O parse_backticks -n -c echo "foo = `echo hi`" ===== echo "foo = `echo hi`" ^ [ -c flag ]:1: Use $(cmd) instead of backticks (parse_backticks) ===== CASE: -n -c echo $ ===== (command.Simple blame_tok: more_env: [] words: [{} {}] redirects: [] do_fork: T ) ===== CASE: +O parse_dollar -n -c echo $ ===== echo $ ^ [ -c flag ]:1: Literal $ should be quoted like \$ ===== CASE: -n -c echo $ ===== echo $ ^ [ -c flag ]:1: Literal $ should be quoted like \$ ===== CASE: -n -c echo $: ===== (command.Simple blame_tok: more_env: [] words: [{} { }] redirects: [] do_fork: T ) ===== CASE: +O parse_dollar -n -c echo $: ===== echo $: ^ [ -c flag ]:1: Literal $ should be quoted like \$ ===== CASE: -n -c echo $: ===== echo $: ^ [ -c flag ]:1: Literal $ should be quoted like \$ ===== CASE: -n -c echo "$" ===== (command.Simple blame_tok: more_env: [] words: [{} {(DQ )}] redirects: [] do_fork: T ) ===== CASE: +O parse_dollar -n -c echo "$" ===== echo "$" ^ [ -c flag ]:1: Literal $ should be quoted like \$ ===== CASE: -n -c echo "$" ===== echo "$" ^ [ -c flag ]:1: Literal $ should be quoted like \$ ===== CASE: -n -c echo "$:" ===== (command.Simple blame_tok: more_env: [] words: [{} {(DQ <":">)}] redirects: [] do_fork: T ) ===== CASE: +O parse_dollar -n -c echo "$:" ===== echo "$:" ^ [ -c flag ]:1: Literal $ should be quoted like \$ ===== CASE: -n -c echo "$:" ===== echo "$:" ^ [ -c flag ]:1: Literal $ should be quoted like \$ ===== CASE: -n -c echo ${x:-$} ===== (command.Simple blame_tok: more_env: [] words: [ {} { (BracedVarSub left: token: var_name: x suffix_op: (suffix_op.Unary op: arg_word:{}) right: ) } ] redirects: [] do_fork: T ) ===== CASE: +O parse_dollar -n -c echo ${x:-$} ===== echo ${x:-$} ^ [ -c flag ]:1: Literal $ should be quoted like \$ ===== CASE: -n -c echo ${x:-$} ===== echo ${x:-$} ^ [ -c flag ]:1: Literal $ should be quoted like \$ ===== CASE: -n -c echo ${x:-$:} ===== (command.Simple blame_tok: more_env: [] words: [ {} { (BracedVarSub left: token: var_name: x suffix_op: (suffix_op.Unary op: arg_word:{ <":">}) right: ) } ] redirects: [] do_fork: T ) ===== CASE: +O parse_dollar -n -c echo ${x:-$:} ===== echo ${x:-$:} ^ [ -c flag ]:1: Literal $ should be quoted like \$ ===== CASE: -n -c echo ${x:-$:} ===== echo ${x:-$:} ^ [ -c flag ]:1: Literal $ should be quoted like \$ ===== CASE: -n -c echo "${x:-$}" ===== (command.Simple blame_tok: more_env: [] words: [ {} { (DQ (BracedVarSub left: token: var_name: x suffix_op: (suffix_op.Unary op: arg_word:{}) right: ) ) } ] redirects: [] do_fork: T ) ===== CASE: +O parse_dollar -n -c echo "${x:-$}" ===== echo "${x:-$}" ^ [ -c flag ]:1: Literal $ should be quoted like \$ ===== CASE: -n -c echo "${x:-$}" ===== echo "${x:-$}" ^ [ -c flag ]:1: Literal $ should be quoted like \$ ===== CASE: -n -c echo "${x:-$:}" ===== (command.Simple blame_tok: more_env: [] words: [ {} { (DQ (BracedVarSub left: token: var_name: x suffix_op: (suffix_op.Unary op: arg_word:{ <":">}) right: ) ) } ] redirects: [] do_fork: T ) ===== CASE: +O parse_dollar -n -c echo "${x:-$:}" ===== echo "${x:-$:}" ^ [ -c flag ]:1: Literal $ should be quoted like \$ ===== CASE: -n -c echo "${x:-$:}" ===== echo "${x:-$:}" ^ [ -c flag ]:1: Literal $ should be quoted like \$ test/parse-errors.sh: line 906: parse_backslash: command not found ===== CASE: -n -c ((1 > 0 && 43 > 42)) ===== (command.DParen left: child: (arith_expr.Binary op_id: Id.Arith_DAmp left: (arith_expr.Binary op_id:Id.Arith_Great left:{} right:{}) right: (arith_expr.Binary op_id: Id.Arith_Great left: {} right: {} ) ) right: redirects: [] ) ===== CASE: -n -c ((1 > 0 && 43 > 42)) ===== ((1 > 0 && 43 > 42)) ^~ [ -c flag ]:1: You may want a space between parens (parse_dparen) ===== CASE: -n -c if ((1 > 0 && 43 > 42)); then echo yes; fi ===== (command.If if_kw: arms: [ (IfArm keyword: cond: (condition.Shell commands: [ (command.Sentence child: (command.DParen left: child: (arith_expr.Binary op_id: Id.Arith_DAmp left: (arith_expr.Binary op_id: Id.Arith_Great left: {} right: {} ) right: (arith_expr.Binary op_id: Id.Arith_Great left: {} right: {} ) ) right: redirects: [] ) terminator: ) ] ) then_kw: action: [ (command.Sentence child: (command.Simple blame_tok: more_env: [] words: [{} {}] redirects: [] do_fork: T ) terminator: ) ] spids: [0 20] ) ] else_action: [] fi_kw: redirects: [] ) ===== CASE: -n -c if ((1 > 0 && 43 > 42)); then echo yes; fi ===== if ((1 > 0 && 43 > 42)); then echo yes; fi ^~ [ -c flag ]:1: You may want a space between parens (parse_dparen) ===== CASE: -n -c for ((x = 1; x < 5; ++x)); do echo $x; done ===== (command.ForExpr keyword: init: (arith_expr.BinaryAssign op_id: Id.Arith_Equal left: ($ Id.Lit_ArithVarLike x) right: {} ) cond: (arith_expr.Binary op_id: Id.Arith_Less left: ($ Id.Lit_ArithVarLike x) right: {} ) update: (arith_expr.UnaryAssign op_id:Id.Arith_DPlus child:($ Id.Lit_ArithVarLike x)) body: (command.DoGroup left: children: [ (command.Sentence child: (command.Simple blame_tok: more_env: [] words: [{} {($ Id.VSub_DollarName x)}] redirects: [] do_fork: T ) terminator: ) ] right: ) redirects: [] ) ===== CASE: -n -c for ((x = 1; x < 5; ++x)); do echo $x; done ===== for ((x = 1; x < 5; ++x)); do echo $x; done ^~ [ -c flag ]:1: Bash for loops aren't allowed (parse_dparen) ===== CASE: -n -c if (1 > 0 and 43 > 42) { echo yes } ===== (command.If if_kw: arms: [ (IfArm keyword: cond: (condition.YshExpr e: (expr.Binary op: left: (expr.Compare left: (expr.Const c:) ops: [] comparators: [(expr.Const c:)] ) right: (expr.Compare left: (expr.Const c:) ops: [] comparators: [(expr.Const c:)] ) ) ) action: [ (command.Simple blame_tok: more_env: [] words: [{} {}] redirects: [] do_fork: T ) ] spids: [0] ) ] else_action: [] redirects: [] ) ===== CASE: -n -c if ( (1 > 0 and 43 > 42) ) { echo yes } ===== (command.If if_kw: arms: [ (IfArm keyword: cond: (condition.YshExpr e: (expr.Binary op: left: (expr.Compare left: (expr.Const c:) ops: [] comparators: [(expr.Const c:)] ) right: (expr.Compare left: (expr.Const c:) ops: [] comparators: [(expr.Const c:)] ) ) ) action: [ (command.Simple blame_tok: more_env: [] words: [{} {}] redirects: [] do_fork: T ) ] spids: [0] ) ] else_action: [] redirects: [] ) test/parse-errors.sh: line 908: ysh_to_make_nicer: command not found test/parse-errors.sh: line 909: ysh_nested_proc: command not found test/parse-errors.sh: line 910: ysh_var_decl: command not found test/parse-errors.sh: line 911: ysh_place_mutation: command not found test/parse-errors.sh: line 912: ysh_case: command not found test/parse-errors.sh: line 913: ysh_for: command not found test/parse-errors.sh: line 914: ysh_for_parse_bare_word: command not found test/parse-errors.sh: line 915: oils_issue_1118: command not found ===== CASE: -n -c for x in & ===== for x in & ^ [ -c flag ]:1: Invalid word in for loop ===== CASE: -n -c for (( i=0; i<10; i++ )) ls ===== for (( i=0; i<10; i++ )) ls ^~ [ -c flag ]:1: Invalid word after for expression ===== CASE: -n -c for ( i=0; i<10; i++ ) ===== for ( i=0; i<10; i++ ) ^ [ -c flag ]:1: Expected loop variable (a constant word) ===== CASE: -n -c for $x in 1 2 3; do echo $i; done ===== for $x in 1 2 3; do echo $i; done ^~ [ -c flag ]:1: Expected loop variable (a constant word) ===== CASE: -n -c for x.y in 1 2 3; do echo $i; done ===== for x.y in 1 2 3; do echo $i; done ^~~ [ -c flag ]:1: Invalid loop variable name 'x.y' ===== CASE: -n -c for x in 1 2 3; & ===== for x in 1 2 3; & ^ [ -c flag ]:1: Expected word type Id.KW_Do, got Id.Op_Amp ===== CASE: -n -c for foo BAD ===== for foo BAD ^ [ -c flag ]:1: Expected loop variable (a constant word) ===== CASE: -n -c for var in x; do echo $var; done ===== (command.ForEach keyword: iter_names: [var] iterable: (for_iter.Words words:[{}]) semi_tok: body: (command.DoGroup left: children: [ (command.Sentence child: (command.Simple blame_tok: more_env: [] words: [{} {($ Id.VSub_DollarName var)}] redirects: [] do_fork: T ) terminator: ) ] right: ) redirects: [] ) test/parse-errors.sh: line 918: parse_at: command not found test/parse-errors.sh: line 788: _parse-error: command not found ===== CASE: -n -c write -- $f(x) ===== write -- $f(x) ^ [ -c flag ]:1: Space required before ( ===== CASE: -n -c write -- @[sorted(x)] ===== write -- @[sorted(x)] ^ [ -c flag ]:1: Unexpected left paren (might need a space before it) ===== CASE: -n -c write -- @[sorted(x)] ===== (command.Simple blame_tok: more_env: [] words: [ {} {<-->} { (word_part.ExprSub left: child: (expr.FuncCall func: (expr.Var name:) args: (ArgList left: pos_args: [(expr.Var name:)] named_args: [] right: ) ) right: ) } ] redirects: [] do_fork: T ) ===== CASE: -n -c f() { write -- @[sorted(x)] } ===== write -- @[sorted(x)] ^ [ -c flag ]:3: Unexpected left paren (might need a space before it) ===== CASE: -n -c f() { write -- @[sorted(x)] } ===== (command.ShFunction name_tok: name: f body: (BraceGroup left: children: [ (command.Simple blame_tok: more_env: [] words: [ {} {<-->} { (word_part.ExprSub left: child: (expr.FuncCall func: (expr.Var name:) args: (ArgList left: pos_args: [(expr.Var name:)] named_args: [] right: ) ) right: ) } ] redirects: [] do_fork: T ) ] redirects: [] right: ) ) ===== CASE: -n -c f() { write -- @sorted (( z )) } ===== write -- @sorted (( z )) ^~ [ -c flag ]:3: Invalid word while parsing command list ===== CASE: code="printf % x" eval $code ===== % ^ [ printf word at line 1 of [ eval word at line 3 of [ -c flag ] ] ]:1: Expected a printf format character ===== CASE: x="echo )" eval $x ===== echo ) ^ [ eval word at line 3 of [ -c flag ] ]:1: Invalid word while parsing command line ---------------------- ===== CASE: test/parse-errors/01-bad-func.sh ===== foo (,) ^ test/parse-errors/01-bad-func.sh:15: Syntax error in expression (near Id.Arith_Comma) ===== CASE: test/parse-errors/02-bad-func.sh ===== foo() ^ test/parse-errors/02-bad-func.sh:3: Unexpected word while parsing compound command ===== CASE: test/parse-errors/05-unterminated-single.sh ===== A B echo 'C ^ test/parse-errors/05-unterminated-single.sh:5: Unexpected EOF in single-quoted string that began here ===== CASE: test/parse-errors/06-unterminated-double-long.sh ===== A B echo 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 " ^ test/parse-errors/06-unterminated-double-long.sh:9: Unexpected EOF reading double-quoted string that began here ===== CASE: test/parse-errors/06-unterminated-double.sh ===== A B echo "0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 ^ test/parse-errors/06-unterminated-double.sh:6: Unexpected EOF reading double-quoted string that began here ===== CASE: test/parse-errors/07-unterminated-here-doc-2.sh ===== cat << "$@" ^ test/parse-errors/07-unterminated-here-doc-2.sh:2: Invalid here doc delimiter ===== CASE: test/parse-errors/07-unterminated-here-doc.sh ===== cat <