Skip to content
Advertisement

Tag: bash

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 – print regex captured groups

I have a file.xml so composed: I need to extract the following information: mayor_and_minor_release_number –> 1.0 patch_number –> 13 suffix –> -alpha I’ve thought the cleanest way to achieve that is by mean of a regex with grep command: I’ve checked with regex101 the correctness of this regex and actually it seems to properly capture the 3 fields I’m looking

how can i echo a line containing single quotes?

I want to echo a line containing single quotes but when I am echoing it, the output comes out without the quotes inside that line. I am using this echo rule_files: [ ‘${path.config}/folder/*.py’ ] and the output is rule_files: [ ${path.config}/folder/*.py ] I want the output to include the single quotes around the path. Answer You have to escape the

Save multiple docker images using one command

Currently I am exporting docker images using below command docker save imageName | gzip > imageName.tar.gz docker save mysql | gzip > mysql.tar.gz This command working fine for single image, i have tons of docker images in my local system, want to export. but i don’t know how to export all images which is available in docker images. Please guide

How do I pass “>>” or “<<" to my script without the terminal trying to interpret it as me either appending to something or getting stdin?

My python script can take a series of bitwise operators as one of its arguments. They all work fine except for “=<<” which is roll left, and “=>>” which is roll right. I run my script like ./script.py -b +4,-4,=>>10,=<<1, where anything after -b can be any combination of similar operations. As soon as the terminal sees “<<” though, it

Advertisement