On Sun, 2005-08-28 at 13:53 -0500, Les Mikesell wrote: > On Sun, 2005-08-28 at 12:32, Claude Jones wrote: > > On Sun August 28 2005 1:23 pm, Les Mikesell wrote: > > > On Sun, 2005-08-28 at 09:31, Claude Jones wrote: > > > > On Sun August 28 2005 6:04 am, gb spam wrote: > > > > > cat > /etc/sysconfig/desktop << EOF > > > > > DESKTOP="KDE" > > > > > DISPLAYMANAGER="KDE" > > > > > EOF > > > > > > Cat copies input to output ................ > > Thanks for your explanation. I had taken Tony's suggestion and started looking > > at the man bash pages. So, if I'm getting it right, the above sequence says > > take what I'm about to type and redirect the text into the file 'desktop' in > > the designated location, and keep doing that until I type "EOF" - the first > > '>' is the redirect, and the '<<' is the entry that tells the process to > > continue until it sees the sequence that immediately follows '<<', at which > > point the redirect process terminates. Do I have that right? > > Yes, but note that it is the shell collecting the input when > you use this construction, then feeding it to cat. If you > just: > cat >file > type...type > type.. > control-d > cat inherits your keybord as it's stdin, and a special case > for tty type inputs is that control-d as the first thing > after a newline generates an end-of-file as seen by the > reading program (controlled by "stty"). > This is true, but the control-d is the universal eof input for many apps. This is the true eof character and makes things operate as if they actually read an eof (as they would if input were from a file and processing continued to the end of file). The most common usage of cat in fact is to display the contents of a file and that terminates when the eof is reached/read, thus the 'cat' process terminates when given a control-d whether from stdin or from a file. In the example above with the line cat > /etc/sysconfig/desktop << EOF it is telling the shell to allow cat to continue processing until it reads a literal string with the three characters "EOF". In this usage format, when the "EOF" is seen the shell sends a literal eof character (control-d) to the cat process (cat never actually sees the string EOF). While the functionality is similar the means is totally different. > -- > Les Mikesell > lesmikesell@xxxxxxxxx > >