ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I want to write a small BASH script that will run when I play and mp3, i want it to check if gmplayer is open then if it is kill it and reopen it with the new song if its not open just open it and play the song, how do i do this, the reason i need this is if i go to play a song and one is playing it opens another so i get errors saying sound card is in use.
Last edited by bluedude2288; 06-11-2004 at 03:23 PM.
ps, grep, kill, test, if...then...else...fi, mplayer flags. Those would be the main ingredients. Just grep ps for whether it's running and kill it if it is, and don't if it's not. The man pages for those items will give full details.
Ought to be an option to switch songs in mplayer, but I dunno - I use mplayer for video and xmms for audio.
Ok thanks for the replies, but one other question, how do you send a key command to a specific program from in the script, this is because when i do a killall i get an error dialog saying terminated by 15 or something similar, insted to close the program i'd like to send it the escape key or q key to close it.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.