LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-10-2012, 09:38 PM   #1
thetenor
LQ Newbie
 
Registered: Aug 2011
Posts: 23

Rep: Reputation: Disabled
Installing libmad: Here Documents


These are the full instructions for installing libmad. I'm trying to figure out what the part with "cat" does. From what I know about "here docs," "here docs" are supposed to be embedded in scripts. Below, I understand how the input following the file /usr/lib/pkgconfig/mad.pc is concatenated with the file. However, I don't understand how the "here doc" format works with using "cat" from the command line. I can't tell if these instructions are telling me to add from "cat" to "EOF" to some script or if I am supposed to use it just like a "cat" command.


Installation of libmad

Install libmad by running the following commands:

./configure --prefix=/usr &&
make

This package does not come with a test suite.

Now, as the root user:

make install

Some packages check for the pkg-config file for libmad. This file is particularly needed so that Cdrdao can recognize the installed libmad.

As the root user:

cat > /usr/lib/pkgconfig/mad.pc << "EOF"
prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: mad
Description: MPEG audio decoder
Requires:
Version: 0.15.1b
Libs: -L${libdir} -lmad
Cflags: -I${includedir}
EOF
 
Old 04-12-2012, 06:13 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392
Quote:
Originally Posted by thetenor View Post
However, I don't understand how the "here doc" format works with using "cat" from the command line. I can't tell if these instructions are telling me to add from "cat" to "EOF" to some script or if I am supposed to use it just like a "cat" command.

Code:
cat > /usr/lib/pkgconfig/mad.pc << "EOF"
prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: mad
Description: MPEG audio decoder
Requires:
Version: 0.15.1b
Libs: -L${libdir} -lmad
Cflags: -I${includedir}
EOF
This is a regular cat command with input (the green part) and redirected output (the blue part). The here-document (all between "EOF" and EOF) is a container that holds the input. All this is one command.

You can copy/paste (or type) this in the shell. You will see a > (the PS2 prompt) at the beginning of the lines when you type or copy/paste, this is bash telling you that it hasn't seen the closing EOF (command isn't complete yet).

Hope this helps.
 
Old 04-12-2012, 11:02 AM   #3
thetenor
LQ Newbie
 
Registered: Aug 2011
Posts: 23

Original Poster
Rep: Reputation: Disabled
So, just so I can be clear, the << simply tells cat that everything between the EOFs will be concatenated with /usr/lib/pkgconfig/mad.pc.

Also, I appreciate your reponse.
 
Old 04-12-2012, 11:10 AM   #4
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian + kde 4 / 5
Posts: 6,837

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
Everything in the heredoc is sent to the stdin of cat, and the stdout of cat is redirected into the filename.

Redirections, including heredocs, need to be associated with a process. In this case cat simply acts as a "pipe" between the heredoc and the file.

Last edited by David the H.; 04-12-2012 at 11:13 AM. Reason: rewording for clarity
 
Old 04-12-2012, 12:07 PM   #5
thetenor
LQ Newbie
 
Registered: Aug 2011
Posts: 23

Original Poster
Rep: Reputation: Disabled
Thank you David and Druuna.
 
Old 04-12-2012, 12:57 PM   #6
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392
You're welcome

BTW: Can you put up the [SOLVED] tag.
first post -> Thread Tools -> Mark this thread as solved
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Mplayer needs libmad.so.0 CrazyKvn Linux - Software 32 11-14-2006 12:43 AM
uninstalling libmad-0.15.1b johnp12 Linux - Software 4 03-01-2006 05:55 AM
Installing libmad mp3 plugin lifeartist Linux - Software 1 12-18-2005 02:54 PM
libmad.so.0 Gonto SUSE / openSUSE 10 06-07-2005 08:01 PM
audacity and libmad.so.0 xviddivxoggmp3 Red Hat 2 08-08-2004 02:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:41 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration