I have script purpose of script is to terminate execution on any non zero command exit code with set -e except when command is “caught” (comming from Java) as in case of bad command asd however, though I “catch” the error and end of script prints to terminal, the error code is 0 so my …
Tag: bash
Write background command output (stdout) to file during execution
I have a command that takes a long time that I like to run in the background like this: This works perfectly in the sense that the command is indeed in the background and I can check the output and potential errors later. The main problem is the output is only appended after the command is completely finished…
How to fix failed to link /usr/bin/gradle -> /etc/alternatives/gradle: /usr/bin/gradle exists and it is not a symlink
I got the below error failed to link /usr/bin/gradle -> /etc/alternatives/gradle: /usr/bin/gradle exists and it is not a symlink I want to change the gradle version of my linux fedora from gradle 4.4.1 to gradle 2.14.1. I have downloaded and extracted the archive of the new gradle file and moved it to /opt…
Iterate through commands and execute in bash
I wrote a script that transfers a new key to my AWS instances. The script executes with no errors, but when I check the ~/.ssh/authorized_keys file on the instance, I do not see the new SSH key. Here is the script: It does print out “Key copied” I have changed the ip addresses of the servers. If I…
Shell: Pass function with arguments as function argument
I’m working on a shell program to automatise my Arch (mandatory btw) installation. To make it more interactive, I’ve built the following function: I’ve succeeded in passing an “echo Hello World!” as an argument and having it run. I’ve also been able to pass another function…
Bash increase pid kernel to unlimited for huge loop
I’ve been try to make cURL on a huge loop and I run the cURL into background process with bash, there are about 904 domains that will be cURLed and the problem is that 904 domains can’t all be embedded because of the PID limit on the Linux kernel. I have tried adding pid_max to 4194303 (I read in …
I want to pipe the output of one script to different script that will process the output of the first script independently?
I have a very trivial bash script taking input from the user in the first step and then echo an output. I want to run the same script in different shells and let the first shell take input and echo its output and send it to the input of the other shell, and let the both of shells continue executing
Make Python script combined with linux packages easy installable for end-user
I wrote a python script that uses numpy, multiprocessing, tqdm and a feq other Python libraries. Additionally, I run packages (e.g. samtools, bwa, GATK) set are necessary to be installed in linux (apt-get install). I’d like to somehow wrap all these dependencies up to make the final installation as user…
want to sort my log file on this timestamp 2019-06-29T12:39:23.428Z using sort command but confused as there are multiple delimeter
This is the format of timestamp on which 2019-06-29T12:39:23.428Z I want to sort. But the year is delimited by – and the time is delimited by : and both year and time are separated my T’. Tried this. Answer You can manually pick out each field to sort with -k from man: So something like this shoul…
How to run a command on file in directory recursively creating a new file in each directory being visited (Bash)?
I have a directory with a few sub-directories. I’d like to create a copy of each results.csv file in the same directory named results_cleaned.csv where certain lines will be removed. Each sub-directory is known to contain only a single file, results.csv. Running this on a single directory works: However…