To read a selected text in GUI out loud I use the command xsel | espeak-ng -v mb-us3 -p3 -s135. To stop it I use killall -s STOP espeak-ng. To start it again killall -s CONT espeak-ng. All 3 commands work, but the noob I am won’t let me archive correct results. The problem is in the if- and case-statement
Tag: bash
Bash regex for same sender and receiver with backreference
I try to make a regex (important that ist a regex because i need it for fail2ban) to match when the receiver and the sender are the same person: What am I doing wrong ? Answer You might use a pattern to match the format of the string between the brackets with a backreference to that capture. Explanation from Match
Why is kill -2 not killing the process?
EDIT: From my tests, it seems not to be possible to terminate a process with the SIGINT/SIGQUIT signal from a script. I do not know why though. I am working on Centos 7, with bash. I would like to know why isn’t kill -2 $pid killing the process. I have a master script that starts a subprocess. That subprocess stays
How to manage file or folder permissions between two user accounts on Linux
There are two users: the user jenkins and the user nginx (both are actually the service accounts). First, the user jenkins creates the directory frontend in the /usr/share/nginx/html folder. Then it downloads some html files saving them in this folder. Then the user nginx tries to open one of the html files and gets the Permission denied error. To fix
bash extract version string & convert to version dot
I want to extract version string (1_4_5) from my-app-1_4_5.img and then convert into dot version (1.4.5) without filename. Version string will have three (1_4_5) or four (1_4_5_7) segments. Have this one liner working ls my-app-1_4_5.img | cut -d’-‘ -f 3 | cut -d’.’ -f 1 | tr _ . Would like to know if there is any better way rather
Bash script – Loop through directory with regex
I’m sure this must be possible, but I’m not sure how. What I’m trying to do is loop through a directory, looking for numeric directories within, and get their disk space. This is what I’ve come up with, but it’s not dealing with the regex. In case it’s not clear, I have a directory containing a bunch of directories with
Redirect parallel process bash script output to individual log file
I have a requirement, where i need to pass multiple arguments to the script to trigger parallel process for each argument. Now i need to capture each process output in the separate log file. Above piece of code can only give parallel processing for the input arguments. I tried with exec > >(tee “/path/of/log/$arg_filedate +%Y%m%d%H.log”) 2>&1 and it was able
Trying to rename files using two txt files but not getting the right results
recently just tried to write a script so I could rename multiple files from two txt files in correct order, it kinda works but not getting the results I’m looking for. If anyone can see what’s wrong with this please let me know! Answer Assuming that both files have exactly the same number of lines (each line representing a filename),
Encountered error using awk in an alias command (bash)
Good day, Im trying to create an alias using awk to filter based on a column which has number greater than a set limit. Its ok when used as a command line but when I assign it as an alias, it prompts error. $5 is column 5 on the grep output while 15 is the set limit. When I set
shell script that runs program that takes two input files
I want to develop a shell script that calls a program that requires two input files. The question is that, it is not only one pair that has to process it, but x number of pairs that are in the same directory. In the directory I have for example: The command line of the program is as follows: And what