Bash Question: HowTo Exit Script with User Input While Process is Running Mid-Loop?
Hi, I have written a script that allows me to repetitively play a music file $N times, which is specified through user input. However, if I want to exit the script before it has finished looping $N times, if I use CTRL+c, I have to CTRL+c however many times are left in order to complete the loop. For instance, if I specified that the song is to repeat 5 times, if during the first iteration through the loop, if I use CTRL+c to exit the script, I will have to press CTRL+c four more times before the script will terminate.
My objective is to be able to type 'q' or some character in order to quit the process. I have found limited information about this topic online, and what I have found has not worked for me.
Although my script provides more options than what is listed below, here it is in its most basic form (note - I'm using mplayer to play the audio file):
Does anyone have any recommendations on how I can exit from the script using keyboard input in such a way that I'm not stuck in the loop and that the script actually terminates?
I have multiple input files that I want to manipulate using a shell script. The files are called 250.1 through 250.1000 but I only want the script to manipulate 250.300 through 250.1000. Before I was using the following script to manipulate the text files:
for i in 250.*; do
|| awk... (4 Replies)
Need help in scripting . Below is the situation and need your inputs
Checking all the processes, scripts running time based on user input time . Below Example
ps -aef -o user,pid,etime,stime,args| grep sleep
<user> 28995 01:24 14:14:39 sleep 120
<user> 29385 00:52 14:15:10... (8 Replies)
Hi Sir,
I am just learning bash scripting and I came across a challenge.
I need to input F11 to a script among many text inputs.
For all the text inputs i did following.
# sh test.sh < input.txt
where input.txt contains all the text inputs in new lines.
This worked fine until i... (1 Reply)
I'm writing a bunch of scripts to automatically configure Ubuntu and I want to run the code below to remove the white dots from the login screen:
sudo xhost +SI:localuser:lightdm
sudo su lightdm -s /bin/bash
gsettings set com.canonical.unity-greeter draw-grid false
The problem is that... (3 Replies)
I want to run a script that calls remote ssh and if it gets hung, I want to be able to kill that part of the script and run another command in the script
for example I have a statement like this:
if ];
then
export tapes=$(for tape in $(su - nacct -c 'ssh remote1 "cat... (1 Reply)
Heyas,
Since this question (similar) occur every now and then, and given the fact i was thinking about it just recently (1-2 weeks) anyway, i started to write something :p
The last point for motivation was... (17 Replies)
I have the following while loop that I put in a script, demo.sh:
while read rna; do
aawork=$(echo "${rna}" | sed -n -e 's/\(...\)\1 /gp' | sed -f rna.sed)
echo "$aawork" | sed 's/ //g'
echo "$aawork" | tr ' ' '\012' | sort | sed '/^$/d' | uniq -c | sed 's/*\(*\) \(.*\)/\2: \... (3 Replies)
Hi everyone, I'm new here and just a beginner in linux scripting.
Just want to ask for help on this one.
I am trying to create a script that will accept user input (year-month and user/s).
I wanted to have the script to continue running, until the user inputs a DATE and name/s of user/s. ... (2 Replies)
Hello,
I am running a bash script to do an rsync back on a computer running MacOS High Sierra. This is the script I am using,
#!/bin/bash
# main backup location, trailing slash included
backup_loc="/Volumes/Archive_Volume/00_macos_backup/"
# generic backup function
function backup {... (12 Replies)
Discussion started by: LMHmedchem
12 Replies
LEARN ABOUT SUSE
xmms2-et
XMMS2-ET(1) General Commands Manual XMMS2-ET(1)NAME
xmms2-et - transmits an anonymous informative packet to the XMMS2 team on each song change
SYNOPSIS
xmms2-et
DESCRIPTION
XMMS2 is a redesign of the XMMS (http://www.xmms.org) music player. It features a client-server model, allowing multiple (even simultane-
ous!) user interfaces, both textual and graphical. All common audio formats are supported using plugins. On top of this, there is a flexi-
ble media library to organize your music.
xmms2-et is the ET Phone Home Client for XMMS2. xmms2-et is designed to transmit a packet of information to the XMMS2 team whenever a new
song is played. The packet is anonymous and does not contain metadata about the song being played. The specifics of what data is transmit-
ted to the XMMS2 team can be found in the ET PACKET section of this manual page.
xmms2-et is used for release engineering by the XMMS2 team. During a release cycle, the usage of various plugins, operating systems, and
XMMS2 components is collected from data transmitted by the xmms2-et client. A release is made when sufficient testing has occured as deter-
mined by the number of related xmms2-et packets that the XMMS2 team has received.
ET PACKET
The following data is transmitted with every packet transmitted by xmms2-et:
XMMS2-ET status
Begins XMMS2-ET packets; status gives a descriptive message denoting what this packet is about. (e.g. Clean shutdown, Unclean shut-
down, New media)
version=version
contains the version of the XMMS2 daemon
system=os
contains the name and release of the operating system on which xmms2d is running
output=output_plugin
contains the output plugin being used to playback audio by xmms2d
starttime=start_time
contains the time at which the xmms2-et client was started
uptime=xmms2d_uptime
contains the uptime of the xmms2-et client
playlistloads=times
contains the number of times a playlist has been loaded from the Media Library
mlibresolves=times
contains the number of times that metadata has been resolved for media in the Media Library
The following data is different for each song being played:
decoder=plugin
contains the decoder plugin used to playback the last played song
transport=plugin
contains the transport plugin used to read the last played song
samplefmt:in=in_fmt
contains the sample format of the original audio file of the last played song
samplefmt:out=out_fmt
contains the sample format that was sent to the output plugin for the last played song
samplerate:in=in_rate
contains the sample rate of the original audio file of the last played song
samplerate:out=out_rate
contains the sample rate that was sent to the output plugin for the last played song
channels:in=number_in
contains the number of channels of the original audio file of the last played song
channels:out=number_out
contains the number of channels that were sent to the output plugin for the last played song
ENVIRONMENTAL VARIABLES
XMMS_PATH
The URL path to xmms2d. See IPC SOCKET in xmms2d(8) for details of possible values for this variable
SEE ALSO xmms2(1), xmms2d(8), http://xmms2.xmms.org
HISTORY
The XMMS2 Project was started by Tobias Rundstrom and Anders Gustafsson. It is developed with their lead by a small group of contributers
from all over the world.
AUTHOR
This manual page was written by Alexander Botero-Lowry <alex@foxybanana.com>
XMMS2-ET(1)