LinuxQuestions.org
Visit Jeremy's Blog.
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 03-16-2004, 02:59 PM   #1
andrewstr
Member
 
Registered: Oct 2003
Location: WA--USA
Distribution: Red Hat 9, Suse 10.2
Posts: 144

Rep: Reputation: 15
Question bash script to accept input ONLY until background process completes


I am setting up a bash script to act as a jukebox music player of sorts. The audio files are being played by mpg123. I want to allow the user various options while mpg123 is playing the music file. The options could be "quit" or "next song" for example.

I know how to use the "read" command to get user input but I don't know how to cancel the read command upon the completion of the sound file.

Any ideas?
 
Old 03-16-2004, 06:35 PM   #2
maillion
Member
 
Registered: Jan 2004
Location: Texas, USA, Terra
Distribution: Debian (currently...)
Posts: 74

Rep: Reputation: 15
Re: bash script to accept input ONLY until background process completes

Quote:
Originally posted by andrewstr
I am setting up a bash script to act as a jukebox music player of sorts. The audio files are being played by mpg123. I want to allow the user various options while mpg123 is playing the music file. The options could be "quit" or "next song" for example.

I know how to use the "read" command to get user input but I don't know how to cancel the read command upon the completion of the sound file.

Any ideas?
Try "select". It is made for menus and such. Look at the man pages to get the syntax.
 
Old 03-17-2004, 12:02 PM   #3
andrewstr
Member
 
Registered: Oct 2003
Location: WA--USA
Distribution: Red Hat 9, Suse 10.2
Posts: 144

Original Poster
Rep: Reputation: 15
maillion,

thanks for the tip! From reading info on the select command, it appears to be perfect for my application.

Any ideas on the second part of my question? How can I kill the select menu if no option is selected by the time mpg123 is finished playing a song?
 
  


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
sed doesn't accept $variable in bash script chii-chan Programming 6 05-28-2005 07:07 AM
Bash - background process and exit ?? michael_util Programming 4 01-05-2005 11:03 AM
send automatic input to a script called by another script in bash programming jorgecab Programming 2 04-01-2004 12:20 AM
User input using a BASH script... causticmtl Programming 5 07-13-2003 09:59 PM
bash-script input aizkorri Programming 7 07-08-2003 06:15 AM

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

All times are GMT -5. The time now is 05:02 AM.

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