Skip to content

Tag: bash

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 subp…

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…

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 d…