Skip to content
Advertisement

Tag: shell

Bash script does not wait for user to enter response

I am trying to read a text file (line by line) and take user response in a while loop. However, the script does not wait to take input. Instead, it just prints all the text to screen. The script only prints alternate text lines from the file (Please refer to the image below). Output Answer This worked for me:

Bash escape character

I have this very reduced example of a bash command, where I want the $ sign escaped. So the command : should print out: a simple $test does not work unfortunately. I tried lots of other stuff but still couldn’t find a solution. Any suggestions ? Answer Put it in single quotes rather than double quotes. The single quotes keep

How to get audio length for all audios using sox?

I can do soxi -d * to get audio length information in hours, minutes, and seconds. However it would only give me info on the individual audio length. If I wanted to see the audio length for the entire folder, how can I accomplish such task? like when you do “wc -w” it shows the sum of everything at the

Bash – How can i send notification once if a service is not running?

I am running the following script to check if my docker services are running. If a service isn’t running, the script sent a message to my rocketchat app via webhook like this: It works, but if a docker service is not running, i receive the message every minute again, because the script is running every minute via cronjob. So how

How to add number assigned as array

I have that script that is supposed to read data from two txt files and add them. For that matter I have used array. I can read the data but there is a problem with the addition. Instead of ${dataAll[$i]}= $( ${data1[$i]}+${data2[$i]} ), I have also used ‘expr ${data1[$i]}+${data2[$i]}’ The analysisSBM105.out file has the following But still it doesn’t work.

Advertisement