Skip to content
Advertisement

Tag: bash

Print min and max with awk

Why wont this awk script work, where I want to print the min and max of an input by just reading the data once. I would also like to initialize the min and max variable with the first value of the data. Say I have a file I am using awk to print the min and max with: But I

Cleanup output from GDB memory dump

We lost a configuration file which we were able to recover some of the data with a gdb memory dump but many important parts of the file are buried in memory noise. Is there a way to cleanup the dump files? Example output Answer The strings command was able to remove the garbage from the file.

Setting environment variable to command in a script

I made a bash script. It reads a file contains a list of commands and runs each of them. A list of commands is like below. Each line has a environment variable before command to set same name but different value to commands. A script is like below. I expect: run command1 with ENV_NUMBER=1 run command2 with ENV_NUMBER=2 run command3

Stop running script but not programm it started

I have a script on my Raspberry Pi that starts the browser in kiosk mode. But if I do so the script keeps running even if i pipe the output to /dev/null like this ./script 2> /dev/null If i stop the script with ctrl+c the browser gets killed as well. How can I run the script without having it to

How to change java version within a bash script?

I have one piece of a script that needs a different java version to the rest of the script, up till now I’ve always manually changed versions with sudo update-alternatives –config java and then just select the one I need. Is there a way to do that within a bash script? I’ve tried export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/bin/java which matches the path listed

How do I create the same directory in every subdirectories in bash?

I’ve been trying to create the directory “a” inside all the subdirectories of “example”. What I tried is the following: But it doesn’t take the ‘*’ as a wildcard, returning mkdir: can not create «example/*/a» directory: It doesn’t exist file or directory Note that I have too much subdirectories in example, so I can’t do it by creating a list.

Get string between two regex

I have a string that is like that(comes from a curl command’s body): The server returns an xml Sometimes this strong can become or some other error: I’m wonder what would be the best way to grep the status code 200 and if it is not 200. Give an error like “Status code is 500 with error: java.lang.IllegalStateException: Archive not

Advertisement