Operating System - HP-UX
1823088 Members
3307 Online
109646 Solutions
New Discussion юеВ

Difference between <<EOF and <<EOS

 
SOLVED
Go to solution
Kim Kendall
Regular Advisor

Difference between <<EOF and <<EOS

Just curious what the differences are between the use of the <
6 REPLIES 6
curt larson_1
Honored Contributor
Solution

Re: Difference between <<EOF and <<EOS

you can specify that one or more commands in your script read input from lines within your script, rather then from your terminal. To do this, use the I/O redirection operator <<, followed by an arbitary delimiter-word. The lines starting after the next newline and continuing until a line containing only the delimiter-word, are called a here-document.

with <
RAC_1
Honored Contributor

Re: Difference between <<EOF and <<EOS

You can put whatever you want

ssomething << KIM

you code here

KIM.

It will read input till it encounters KIM.
There is no substitute to HARDWORK
Kim Kendall
Regular Advisor

Re: Difference between <<EOF and <<EOS

Great! Thats what I was looking for... what it is called ... "here documents"

Thx!
Darren Prior
Honored Contributor

Re: Difference between <<EOF and <<EOS

Hi Kim,

yes, it's a "here document." There is a small mention of them in the sh-posix man page, if you search for <<

regards,

Darren.
Calm down. It's only ones and zeros...
hein coulier
Frequent Advisor

Re: Difference between <<EOF and <<EOS

You just have to watched out for little mistakes, like putting a space between "<<" and "KIM". I wasted a lot of time with typos like that.
Kim Kendall
Regular Advisor

Re: Difference between <<EOF and <<EOS

I've seen examples like :

<<-EOS "
___more commands
___more commands "
___EOS

Where "___" is whitespace.

Using quotes and whitespace (if you preface the EOS with a dash)