SC1041,1042 Cannot Find 'EOF' with Output Redirection on Same Line
See original GitHub issueOS: Windows 10 Enterprise, Version 1909, Build 18363.1556 VSCode Version: 1.56.2 Shellcheck Version: 0.7.2 (installed from .zip on GitHub)
The following code works on shellcheck.net, but fails in VSCode on Windows:
#! /bin/sh -
my_file_='example.txt'
# Overcoming a strange Cygwin error
command cat <<EOF >"${my_file_}"
#! /bin/sh
exit 0
EOF
This could be fixed by putting >“${my_file_}” before <<EOF
, but the bigger issue is VSCode sees ‘EOF\r’ at end (NOTE: This is not fixed by ignoring carriage-return/new-lines errors with # shellcheck disable=SC1017
. Furthermore, the above code works on shellcheck.net, so I believe the problem is with the VSCode extension.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6
Top Results From Across the Web
SC1041,1042 Cannot Find 'EOF' with Output Redirection on ...
There is definitely a Windows element to this as it is detecting a newline simply as a carriage return. This specific error can...
Read more >How do you use output redirection in combination with here ...
When it's evaluating the command-line and finds the <<EOF, it then reads from standard input until either a line with only EOF is...
Read more >Redirecting stdout of EOF - Stack Overflow
I called gnuplot and not psql , but the idea about EOF and redirecting is the same. Share.
Read more >How to redirect the output when we are usinf EOF in the same ...
Could somebody help me on how to redirect output of command line and process it line by line without sending output to any...
Read more >Input Output Redirection in Linux/Unix Examples - Guru99
If there is an existing file with the same name, the redirected command will delete the contents of that file and then it...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@felipecrs I wrote the scripts in Cygwin real quick with Vim and they worked (shellcheck returned nothing, which I’m assuming means no errors)
That’s cool to hear, @adamgranthendry. Did you also try to execute your scripts in Cygwin just to confirm that they are still working?