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

Parse difference for KSH, no semicolon required after double brackets #1099

Open
1 task done
masalomon opened this issue Jan 24, 2018 · 0 comments
Open
1 task done

Comments

@masalomon
Copy link

For bugs

  • Rule Id SC1049, and possibly others.
  • My shellcheck version (shellcheck --version or "online"): online
  • I tried on shellcheck.net and verified that this is still a problem on the latest commit

Here's a snippet or screenshot that shows the problem:

#! /bin/ksh
if [[ -z "" ]] then echo yes ; fi

Here's what shellcheck currently says:

SC1049: Did you forget the 'then' for this 'if'?
SC1073: Couldn't parse this if expression. Fix to allow more checks.
SC1010: Use semicolon or linefeed before 'then' (or quote to make it literal).
SC1050: Expected 'then'.
SC1072: Unexpected keyword/token. Fix any mentioned problems and try again.

Here's what I wanted or expected to see:

Nothing. This is valid in Ksh, as far back as ksh88. The semicolon is not required before the then if the if condition uses double brackets.

See related StackOverflow question: https://stackoverflow.com/q/48107383/1313898

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

No branches or pull requests

1 participant