how to proceed with chapter 7 concerning cat > output << EOF

Gerard Beekmans gerard at linuxfromscratch.org
Thu Nov 2 08:20:37 PST 2000


Hi,

If we want to create all files in the book using cat > output << EOF 
constructions we have a little problem in chapter 7 - the boot scripts.

Take the first few lines from the rc script:

source /etc/init.d/functions

print_error_msg()
{

        echo
        $FAILURE
<cut>

if we do that in a cat > rc << EOF it will not work properly due to the $ and 
in other files the commands includes in ` like kill -9 `cat /var/run/$1.pid`

If you enter them literally, bash will try to execute those. So we have to 
escape them. The book will then contain:

cat > rc << EOF

<cut>

print_error_msg()
{

        echo
        \$FAILURE
<cut>
EOF

Now $FAILURE will be put in the rc file. But if people choose not to use the 
cat command but just copy&paste the content into a file, those backslashes 
will become a problem.

So we either can't use the content in the book in a cat > out << EOF 
construction and you have copy&paste into vim, or you can do a cat but you 
cannot copy&paste into vim.

Although I would much prefer the cat option personally, not everybody will be 
happy with it.

A solution could be to create yet another appendix and put the plain scripts 
in there without escape sequences (backslashes). Or tell the readers to 
download the scripts if they don't want to use the 'cat' construction, but i 
rather not do that because it's very limiting.

Opinions and/or alternatives are very welcome

-- 
Gerard Beekmans
www.linuxfromscratch.org

-*- If Linux doesn't have the solution, you have the wrong problem -*-

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




More information about the lfs-dev mailing list