LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-22-2018, 03:18 AM   #1
luofeiyu
Member
 
Registered: Aug 2015
Posts: 237

Rep: Reputation: Disabled
Stdin,stdout,stderr wehn to run mplayer in background


Run mplayer in background with no stdin,no stdout,no stderr.
Code:
    ~$  mplayer fly.mp3 0</dev/null 1>/dev/null 2>&1 &
It can be simplied as
Code:
    ~$  mplayer fly.mp3 </dev/null >/dev/null 2>&1 &
1.Run mplayer in background with no stdin.
Code:
    ~$  mplayer fly.mp3 </dev/null  &
`ctrl+c` can't kill the playing ,it means that `Run mplayer in background with no stdin` take effect.


2.Run mplayer in background with no stdout.
Code:
    ~$  mplayer fly.mp3  1>/dev/null  &
    [1] 8561
    jobs
    [1]+  Stopped                 mplayer fly.mp3 > /dev/null
`mplayer fly.mp3 0</dev/null 1>/dev/null 2>&1 &` can run mplayer in background with no stdin ,no stdout ,no stderr,
why `mplayer fly.mp3 1>/dev/null &` can not run mplayer in background with no stdout?

3.Run mplayer in background with no stderror.
Code:
    ~$  mplayer fly.mp3  2>/dev/null  &
    [1] 6874
    ~$ MPlayer 1.3.0 (Debian), built with gcc-6.2.1 (C) 2000-2016 MPlayer Team
Why no voice?
 
Old 09-22-2018, 10:44 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,366

Rep: Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335
what happens with '$ mplayer fly.mp3' or 'mpg123 fly.mp3'?
 
Old 09-22-2018, 11:22 AM   #3
lougavulin
Member
 
Registered: Jul 2018
Distribution: Slackware,x86_64,current
Posts: 279

Rep: Reputation: 100Reputation: 100
mplayer does read on stdin and write on both stdout and stderr. To send it in background you have to redirect its stdin.
Your commands redirecting only stdout or sdterr don't work because it halts waiting a stdin. As you saw if you redirect only stdin it works.
 
  


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
Need to run PHP script in the background while redirecting STDOUT and STDERR to a fil sneakyimp Linux - Newbie 18 01-07-2013 08:35 PM
[SOLVED] Re-directing stdin, stdout, stderr for program run as fork()/execl() AndrewBS42 Programming 3 11-26-2010 08:35 AM
redirecting stdin, stdout and stderr, and finding files name and other stats wroom Programming 4 08-14-2010 06:48 AM
Shell script stdout, stderr and stdin solo9300 Linux - General 6 12-29-2009 12:33 AM
how to change stdin, stdout & stderr in u-boot to ethernet from serial jynthms Linux - Newbie 1 04-01-2009 09:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:18 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