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

Syntax error not detected with heredoc <<- redirection operator #172

Open
Massedil opened this issue Jul 3, 2019 · 1 comment
Open

Syntax error not detected with heredoc <<- redirection operator #172

Massedil opened this issue Jul 3, 2019 · 1 comment

Comments

@Massedil
Copy link

Massedil commented Jul 3, 2019

I know this error is a little bit tricky but it happens often when using heredoc <<- redirection operator because space and tabs are not visible in that case.

If the redirection operator is ‘<<-’, then all leading tab characters are stripped from input lines and the line containing delimiter. This allows here-documents within shell scripts to be indented in a natural fashion. Source

  1. The error in test_invalid.txt is not detected. There is spaces instead of tabs before EOF.
# bash test_invalid.txt
test_invalid.txt: line 9: warning: here-document at line 5 delimited by end-of-file (wanted `EOF')
test_invalid.txt: line 10: syntax error: unexpected end of file

Expected : There is a parsing error detected.

invalid

  1. This test_valid.txt is valid but the syntax coloration is wrong.
# bash test_valid.txt
# cat /tmp/file
    spaces before
    EOF
    This text is written inside the /tmp/file.

Expected : This text is written inside the /tmp/file. is grey like spaces before.

valid

  1. It could also be interesting in that case to show a difference between whitespace and tab because whitespace will be kept and tab will be ignored.
@jerdoe
Copy link

jerdoe commented Oct 13, 2021

As a temporary workaround, one can show whitespace characters in Eclipse (Differences between whitespaces and tabs are printed)
Capture d’écran de 2021-10-14 00-45-44

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

2 participants