Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack …
Tag: bash
Repack tar.gz to tar and exclude some files
I have a big backup.tar.gz file (260 GB) and about 160 GB of free storage space. Backup file contains three big dumb file (old backups, about 190 GB), which is not needed. So I want to untar backup.tar.gz to pipe excluding some files and tar it back without gzip. I have a text file, which contain names of dum…
How to reuse a function defined in another bash file?
I have a utility function that I used a lot (assertReturnStatus()). I’d like to define it in a utility file (utility.sh) and reuse it in other bash scripts. How can reuse the function from another bash script file? Thanks. Answer You need to “import” the first file in the second. Be warned t…
Bash script wait depended commands processes
I am fairly new in bash scripting. I need to use bash script for manage my microservices, so these services need build and deploy(on docker). So I have commands like that : So as you see(a little part of script, i am grouping depended commands in functions),commands need to wait previous depended commands lik…
How do you convert c code into assembly’s hex representation?
Edit: It appears I have a lot more reading to do… Also, for those telling me this is a bad idea, it’s for a buffer overflow exercise. I have a fairly simple C program: I want to turn it into hex assembly code. Think something like: I tried doing: And that gave me a nice long string of hex. But
Read line output in a shell script
I want to run a program (when executed it produces logdata) out of a shell script and write the output into a text file. I failed to do so :/ $prog is the executed prog -> socat /dev/ttyUSB0,b9600 STDOUT $log/$FILE is just path to a .txt file I had a Perl script to do this: I tried to do this
extract some part of a list of strings and set them in a list without any repetition
I have a list of file names I have tried to extract the index between sil. and .asc and put them in a list while I do not to have the repetition of indexes in my list. The following is some part of the list of my files. The following code is my attempt to make the list but it
Use of $- in shell script
What is use of $- in Unix. In My system, the output is, what is meant by himBH? what it stands for. Thanks in Advance… Answer It returns the current shell’s flags. The $- variable contains the shell’s flags currently active in your terminal. These flags determine how your shell will function…
How to identify directory paths within multi-line string, replace with references to own file content, in Bash?
Given a bash variable containing the following multi-line string representing *nix paths: I’d like to be able to identify all directories (dir1 & dir2, for example) and to replace these directory path lines with the paths of the files below them. There should be no directory references in the final …
Calculate Median and Average of a Text FIle with Multiple Columns of Data
I have a file with multiple columns of data. I need to calculate the median and average of the two columns. Input: Desired Output: I have tried Which is good for only one column of data. Answer Here I’m assuming you meant to work with columns and calculate two sets of values. Your output format is not r…