LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices


Reply
  Search this Thread
Old 09-13-2009, 03:07 AM   #1
Berend58
LQ Newbie
 
Registered: Sep 2009
Posts: 12

Rep: Reputation: 0
LFS "Setting up the environment" problem


Hello,

This is my first post here. I call my self a newby and i am very interested in linux. Before i have installed succesfully Gentoo, which was a nice thing to do and i learned a lot from it. Now there is the next step; installing LFS. By the way: my english is not so good.
My host system is Ubuntu 9.04.
I'am setting up the environment (chapter 4.4, LFS_Book) and got a problem with cat > ~/.bash_profile << "EOF"
After typing that command I get no output in the shell. I wonder if it is a problem with the .bash_profile or with the cat command.

Last edited by Berend58; 09-13-2009 at 12:57 PM.
 
Old 09-13-2009, 03:15 AM   #2
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hello and welcome to LQ,

There's no problem whatsoever with neither the cat command nor with the .bash_profile file. The command you issue at the console just adds the following line that holds exec to the .bash_profile file. It's a faster way then editing .bash_profile with an editor like vi, nano or others.

The command cat in this use doesn't produce any output. To check if everything went well just do
Code:
cat .bash_profile
when in the home directory of user lfs and it will show you the line as needed
Code:
exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash
Kind regards,

Eric
 
Old 09-13-2009, 03:44 AM   #3
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
It looks like the beginning of a standard here document to me. There should be another corresponding "EOF" line later down that ends the block of text to be copied to the file.
 
Old 09-13-2009, 03:48 AM   #4
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
As a matter of fact there is, it's just that the OP didn't post the complete command.

The complete command from the LFS book is:
Code:
cat > ~/.bash_profile << "EOF"
exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash
EOF
Kind regards,

Eric
 
Old 09-13-2009, 04:41 AM   #5
Berend58
LQ Newbie
 
Registered: Sep 2009
Posts: 12

Original Poster
Rep: Reputation: 0
Oke, thanks for your help.
When typing cat .bash_profile, I still get no output.
 
Old 09-13-2009, 04:47 AM   #6
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Are you sure you're in the home directory of the lfs user when executing the command? You can also try:
Code:
cat /home/lfs/.bash_profile
.

If the command from the LFS book was executed correctly then you should have the output as mentioned.

Check also if the file mentioned above exists
Code:
ls -al /home/lfs
.

Since you didn't put the complete command in your original post it might also be that you didn't execute the complete command. In order to try it again if the .bash_profile doesn't exist under /home/lfs, copy the entire command from my second post (the three lines) and paste them when in the /home/lfs directory.

Kind regards,

Eric
 
Old 09-13-2009, 05:04 AM   #7
Berend58
LQ Newbie
 
Registered: Sep 2009
Posts: 12

Original Poster
Rep: Reputation: 0
The command cat .bash_profile gives no output.
Command: ls -al /home/lfs, gives this output, which I think means that the file exists:
Code:
totaal 12
drwxr-xr-x 2 lfs  lfs  4096 2009-09-13 09:08 .
drwxr-xr-x 4 root root 4096 2009-09-13 07:41 ..
-rw------- 1 lfs  lfs   236 2009-09-13 11:32 .bash_history
-rw-r--r-- 1 lfs  lfs     0 2009-09-13 11:31 .bash_profile
-rw-r--r-- 1 lfs  lfs     0 2009-09-13 09:08 .bashrc
You said I have to execute three lines of code, but I thought that the second line typography means that it is screenoutput ( in this case exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash) Am I wrong??
 
Old 09-13-2009, 05:15 AM   #8
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
yep, there's your misunderstanding.

The cat command is normally, among others, used to show the contents of a file.
Code:
cat > ~/.bash_profile << "EOF"
exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash
EOF
With the command used as above you tell the system to redirect the output of cat with the > to a file called .bash_profile in the home directory of the currently logged in user (the one executing the command). Furthermore you're telling cat with << to use input from the console to cat to the file. Using the "EOF" you're also stating to use everything from the console as input until EOF is encountered on a new line.

I hope this makes sense. In short: where you logged in as the lfs user when performing the command? If so, then
Code:
cat /home/lfs/.bash_profile
should give you as output:
Code:
exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash
.
If this is not the fact then you have to repeat the steps:
1. log in as lfs user
2. copy the three lines as indicated in the book
3. paste the three lines in a console window logged in as lfs users
4. check the .bash_profile.

Let us know if it works out.

Kind regards,

Eric
 
Old 09-13-2009, 06:59 AM   #9
Berend58
LQ Newbie
 
Registered: Sep 2009
Posts: 12

Original Poster
Rep: Reputation: 0
That solved the problem. Thanks a lot. I guess creating the .bashrc file, is identical.
Going on with LFS
 
Old 09-13-2009, 07:01 AM   #10
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hi,

Glad it worked out. And yes, the bashrc command is the same. Whatever problem you might encounter, I'm sure someone here at LQ can help you out.

Kind regards,

Eric
 
Old 09-13-2009, 07:07 AM   #11
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Oh and please mark the thread as solved using the Thread Tools.

Kind regards,

Eric
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LFS6.3 livecd "ls : command not found" error after "su - lfs" rotu Linux From Scratch 2 06-19-2008 03:59 PM
LFS 6.3 Chapter 5.4.1 - problem with "make bootstrap" vipernicus42 Linux From Scratch 3 04-21-2008 08:58 PM
"No space" when creating LFS in USB, What can I solve that problem valpa Linux From Scratch 3 06-20-2007 01:18 PM
Setting environment variables for "nobody" player_2 Linux - Software 0 09-02-2003 01:39 PM
LFS 4.1: Stalled at Perl, "missing seperator" error from "make" SparceMatrix Linux From Scratch 1 06-07-2003 03:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 02:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration