If you want a script to enter data from inside the script as if you had typed it, you use the ‘<<’ input redirect like so:

 

#!/bin/bash

echo Put stuff into a_file:

cat << EOFEOF > a_file

This line goes in to the file

So does this

This does too, but the next line tells the shell to stop reading and give an EOF to ‘cat’ so it will stop. 

EOFEOF

echo This is the next line of the script to execute.

 

Execution of this script results in ‘a_file’ having 3 lines, and your screen would look like this:

 

~> ./my_Script

Put stuff into a_file:

This is the next line of the script to execute.

~>

 

Typing ^C or an actual control-c in the file would not work, I think.

 

Rusty

 

From: plug-discuss-bounces@lists.plug.phoenix.az.us [mailto:plug-discuss-bounces@lists.plug.phoenix.az.us] On Behalf Of Michael Havens
Sent: Wednesday, August 29, 2012 9:47 PM
To: Main PLUG discussion list
Subject: Re: text file needs a carriage return

 

wait a second... I don't need a carriage return  but rather cntrl-c. would typing '^C' have the desired effect?

Then the script would look like:

 

  cat > <file>

  tar -xvf <file2>

  cd linux-3.2.6

  make mrproper

  make headers_check

  make INSTALL_HDR_PATH=dest headers_install

  find dest/include \( -name .install -o -name ..install.cmd \) -delete

  cp -rv dest/include/* /usr/include

  ^C

  . <file> 2>1|tee <file3>

 

But I still need the carriage return symbol so I can enter the script and then:

 

  cat <file3>| grep .... uhhhhh..... what text appears in errors in this case?

:-)~MIKE~(-:

On Wed, Aug 29, 2012 at 9:31 PM, Michael Havens <bmike1@gmail.com> wrote:

okay, this is what I got:

 

  cat > <file>

  tar -xvf <file2>

  cd linux-3.2.6

  make mrproper

  make headers_check

  make INSTALL_HDR_PATH=dest headers_install

  find dest/include \( -name .install -o -name ..install.cmd \) -delete

  cp -rv dest/include/* /usr/include

 

then I hit return and after type:

 

  . <file> 2>1|tee <file3>

 

and then hit return again.

So what this does is creates a text file and this example is a kernel builder, So I'm going to change it for each package I need to build for LinuxfromScratch. So I want to be able to just type everything and run it all with:

 

  . <file> 2>1|tee <file>

 

so I can find errors before I move on to the next tar file w/o hiting return before the 'tee' command. So what text do I put to indicate a carriage return?

:-)~MIKE~(-: