Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the syntax in if_else.sh #165

Closed
wants to merge 1 commit into from

Conversation

certik
Copy link
Collaborator

@certik certik commented Sep 27, 2024

The test script if_else.sh has incorrect syntax for an if statement:

$ bash if_else.sh
if_else.sh: line 2: syntax error near unexpected token `then'
if_else.sh: line 2: `if [[ $FOO -eq 1 ]] then'

The correct syntax uses ; before then.

Unfortunately this correct syntax does not parse:

Syntax error:   × Failed to parse input
  ╰─▶ Failure to parse at Pos((2, 16))
   ╭────
 1 │ if [[ $FOO -eq 1 ]]; then
   ·                ┬
   ·                ╰── expected TILDE_PREFIX, UNQUOTED_ESCAPE_CHAR, SUB_COMMAND, or EXIT_STATUS
   ╰────
  help: expected TILDE_PREFIX, UNQUOTED_ESCAPE_CHAR, SUB_COMMAND,
        or EXIT_STATUS

The test script `if_else.sh` has incorrect syntax for an if statement:

    $ bash if_else.sh
    if_else.sh: line 2: syntax error near unexpected token `then'
    if_else.sh: line 2: `if [[ $FOO -eq 1 ]] then'

The correct syntax uses `;` before `then`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants