LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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, 08: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, 05:13 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
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, 10: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, 10:10 AM   #4
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
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 10:13 AM. Reason: rewording for clarity
 
Old 04-12-2012, 11:07 AM   #5
thetenor
LQ Newbie
 
Registered: Aug 2011
Posts: 23

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

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
You're welcome

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


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

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

All times are GMT -5. The time now is 08: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
Open Source Consulting | Domain Registration