I have a bash script (exp1.sh) which invokes another bash script exp2.sh. I want the first script to fail fast when second script exits with error. (The second script actually reads rows from database to stdout, in case of database connectivity error it returns nonzero exit code.) I expect the set -e option c…
Tag: shell
Docker run with arguments from a configuration file
I’ve built a docker image in order to publish a jupyter notebook to my team. The jupyter notebook runs inside a docker container by running a docker run command containing numerous arguments (such as mounts and environment variables for AWS credentials). The current instructions I published for running …
If not exists, create a folder – Error in makefile
I searched over the internet for a command to create a folder if it doesn’t exist. I found it and put in my makefile When the folder doesn’t exist it’s created correctly. But I get an error if the folder already exists. I don’t get why the command would give an error if the condition […
sed command does not execute properly on gitlab runner
I have a script which needs to run npm run test and capture test coverage coverage value so here I am trying to capture the value 36.95 and output it in gitlab script which I am planning to add as a gitlab job. It seems that the runner is gnu. If I execute the below script on my local it
echo printing working directory files names for no reason
why echo printing the files names ? gives this output but running pacmd list-sinks | grep “index:” in the shell gives * index: 1 index: 2 index: 3 Answer pacmd returns * pattern. In for … in …; do … done loop, the list pattern contains * without any protection. So, bash replace *…
Pipe into a shell/bash script from Web URL
How to download a script from URL, execute it, and pipe something into it – all with one command? I have a shell script to which I can pipe stuff: The script is moved to http://example.com/do-stuff.sh Try to do something like this: but it doesn’t work. Data does not get piped into the script. Ther…
Command to list reordered ls columns works in terminal but not through running a script?
I’m trying to make a script that will print information of all files in a given directory in order of owner, group, filename, then permissions separated by commas. The code I wrote works fine when ran in terminal, but when I try to run it through a script with a directory given as $1, it only prints the…
what alternative methods for sudo echo without bash -c
I must run the echo in the script my.sh with sudo because permission. I do not want to execute the script with sudo my.sh. I do not want to use bash -c “…” because escaping. Are there no other solutions? my.sh Answer The problem you are encountering here is that the output redirection >/f…
How we can update MIB variables values dynamically in linux?
I have created one mib file where five variables are added. Also by using the following command I’m able to see the OID’s of the all varialbes. After this by using “PASS protocol” I tried to get the data from the one variable with the help of following script file After running the abo…
Bash script conversion to fish
I’m trying to convert this script to fish: https://github.com/masahide/OmniSSHAgent/blob/main/hack/ubuntu-bash.setup.sh This is my progress so far: It should be fully converted except that main command substitution in the last function: that raises this error: And I don’t understand how to convert…