-1

The error i'm getting is line 30 warning: here-document at line 10 delimited by end of file ('wanted simple.sh'). What does this error mean? Here is what line 10 looks like.

cat <<simple.sh | grep '^[^abc]$.*!$' >>Result

I'm trying to append the output of simple.sh to the file Result.

  • The error is on line 30 but you’re showing us line 10? – Jeff Schaller Feb 28 '18 at 17:19
  • 1
    @JeffSchaller Line 30 is probably the end of the script. – Kusalananda Feb 28 '18 at 17:20
3

The syntax

somecommand <<TAG

starts a here-document. A here-document is a type of input redirection of a text block. The contents of the here-document is ended when TAG is encountered on a line by itself. For example:

cat <<END_TEXT
this is
some text
END_TEXT

The tag can be any word, and in your case, the word is simple.sh, and the shell complains that it can't find the word that would end the here-document.

What I presume you meant is

cat simple.sh | grep ... >>Result

or

cat <simple.sh | grep ... >>Result

or just

grep ... simple.sh >>Result

Also note that the regular expression ^[^abc]$.*!$ can never match as there is no single line with a ! after the end of the line.

  • cat can probably also be removed entirely. grep [whatever] simple.sh >> result should accomplish the same thing. – Thegs Feb 28 '18 at 16:55
  • @Thegs Yes. Added that. – Kusalananda Feb 28 '18 at 16:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.