Skip to content

Part 1.2 : Syntax errors

Vladou73 edited this page Jun 11, 2022 · 1 revision

Syntax errors of tokens (check in lexer)

NO ERRORS

  • starting with redirection : no error > file.txt, < file.txt, << file.txt, >> file.txt : in bash, no error
  • starting with pipe generates error : | echo coucou
  • | >, | <, | >>, | << : no error

1st stack of errors

  • redirection followed by pipe => error
  • < |, > |, >> |, << | : error
  • 2 pipes qui s'enchainent : error | | msg : bash: syntax error near unexpected token |'`

2nd stack of errors

  • redirection without any string afterwards => error
  • echo < , echo >, echo >> , echo << : error
  • echo | : same error for pipe msg : bash: syntax error near unexpected token newline'`

3rd stack of errors

  • redirection following another redirection => error
  • msg : depends on the 2nd redirection token
  • echo < >>, echo > >>, echo >> >>, echo << >> : all have same error msg : bash: syntax error near unexpected token `>>'