A Couple Of Questions

Ulrich Fahrenberg uli at math.auc.dk
Sun Nov 17 02:24:17 PST 2002

On Sat, 16 Nov 2002, John Lowell wrote:

> [lfs at PEER3 lfs]$ cat > ~/.bash_profile << "EOF"
> >umask 022
> >
> >LFS=/mnt/lfs
> >CC='gcc -s'
> >export LFS LC_ALL CC
> >EOF
> At this point, after hitting Enter so as to type
> source ~/.bash_profile
> as instructed and to complete the command, I get back
> [lfs at PEER3 lfs]$
> not
> >
> as I'd expected. Being uncertain how to proceed, it seemed to me I
> had nothing to lose by entering source ~/.bash_profile at the
> prompt and attempting to continue. Have I erred in doing things
> this way?

>From the manpage of bash, section `PROMPTING':

       When executing interactively, bash  displays  the  primary
       prompt  PS1  when  it  is ready to read a command, and the
       secondary prompt PS2 when it needs more input to  complete
       a  command.

In your case, `[lfs at PEER3 lfs]$' is the primary prompt, and `>' is the
secondary. There are two more prompts, PS3 and PS4, but you'll hardly
ever see them.

So what happened was the following: When you enter the
`cat>blabla<<"EOF"' command, you tell bash to record your input until
you type EOF on a line for itself, and to use this recorded input as
the input to file blabla. While recording the input, bash displays the
secondary prompt, and after you typed EOF, bash creates the file and
is ready for the next command, hence displaying the primary prompt.

The `<<' thingy is explained in section `Here Documents' of the bash


Ulrich Fahrenberg -- http://www.math.auc.dk/~uli

Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe lfs-support' in the subject header of the message

More information about the lfs-support mailing list