Quote:
Originally Posted by nutthick
I'm setting up a pipe as follows:
Code:
mkfifo /tmp/mplayer_cmd
then starting the application with this code
Code:
cat /tmp/mplayer_cmd | mplayer -slave test.mp3
The file starts playing.
I then SSH in and type the following
Code:
echo pause > /tmp/mplayer_cmd
and the track pauses. However, any other commands I issue through echo just hang the prompt.
|
What happens is that the pipe (fifo) is closed after the first echo. Try:
Code:
cat > /tmp/mplayer_cmd
and start typing multiple commands. Type <enter> after each command, and CTRL-d to close the pipe when you're done.
Quote:
Originally Posted by nutthick
I'm lost. mkfifo(3) apparently solves it, but what does the (3) mean?
|
"mkfifo(3)" means the man page of the "mkfifo" libc
function which is in section
3 of the man-system, rather than the mkfifo
command which is in section
1 of the manual.
"(3)" is mentioned because there are two different "mkfifo" man-pages. The command "man -k mkfifo" will show all man pages that deal with some "mkfifo" and the section they are in. The command "man 1 mkfifo" will show you the mkfifo man page of section 1 (executables and shell commands) while "man 3 mkfifo" will show the mkfifo C function which is in section 3 (C-library functions). Just "man mkfifo" will show the man page in the lowest numbered section that is called "mkfifo", so in this case it's equivalent to "man 1 mkfifo".
Even if there's no ambiguity to expect (you never know for sure which man pages people have installed), it considered good practice to mention the section when referring to man pages. It also is a brief way to indicate that a man page is refferred to.
To read about the man page sections, see the man page about "man", or better, see man(1).