Category "bash"

generate random number and fill them in array

i want to generate 10 random number between 1 and 100 and store them in an array #!/bin/bash for ((i=0; i<10; i++)) do done

Sort according to two columns and extract top two based on last column

I have a file with three columns. I would like to extract rows with top two values in column 3 for each unique value in column 2. cat file.list run1/xx2/x2c1.tx

pm2 deploy production setup : executing post-setup `yarn && yarn dev` bash: yarn: command not found

I'm trying to use pm2 deploy production update to serve my NextJs app on remote server. I've have already installed yarn locally and also on remote server. It s

Linux script not executing properly after a reboot

I am using a raspberry pi4 with 32bit Raspbian to display some webpages. I have a script to open 2 webpages, one on each monitor. The end of the script selects

Docker bash shell script does not catch SIGINT or SIGTERM

I have the following two files in a directory: Dockerfile FROM debian WORKDIR /app COPY start.sh /app/ CMD ["/app/start.sh"] start.sh (with permissions 755 u

Getting null values in jq bash

I have data.json which looks like this { "type": "AdaptiveCard", "body": [ { "type": "TextBlock", "text": "Monitoring", "wrap": true,

jq: command not found in GitLab CI file

In .gitlab-ci.yml stages: - test-jq test-jq: stage: test-jq image: ruby:2.5 script: - apt-get update - apt-get install

Updating SourceTree's browser.plist with non-existing repositories dynamically

I'd like to traverse some directories containing git repositories with my Bash script and add them to SourceTree's list if they don't exist already. I'd prefera

Loop through an array of strings in Bash?

I want to write a script that loops through 15 strings (array possibly?) Is that possible? Something like: for databaseName in listOfNames then # Do somethi

How to insert text after a certain string in a file with variables

I have these variables: file_path="/home/dir/file.xml" string="<host mac='0A:00:DD:D2:00:02' name='vfp-20vr' ip='10.10.1.122'/>" This is the content of f

take difference between 2nd column values using awk

I have a data file, let's call it fileA. It has two columns and I want to take difference of 2nd column and multiply the output with 13.6 and write it down in 3

Linux - How to get a string specific string from a specific line?

Lets say that I have the following DeletedFiles.txt file: test1.zip - date-removed='6-16-2021' test2.zip - date-removed='6-17-2021' test3.zip - date-remov

replace the header line of several sequences in a fasta file and replace them with the species names stored in a list (.txt)

I have a fasta file with several sequences, but the first line of all the sequences start with the same string (ABI) and I want to change and replace it with th

Executing a bash script from Electron app

I am trying to execute bash script within Electron index.html button click. Here's my code which index.html calling renderer.js, and renderer.js opens the bash

powershell return value $? and custom exit code [closed]

I installed powershell on Linux-Box. At end of my *.PS1 file I put the following code: Exit 2222 I run my ps1 file such as: pwsh-lts -File my

Recursively find files with a specific extension and copy them to a new directory with new names

I tried to find all the .xvg files generated by Gromacs inside a directory as well as its subdirectories and then copy them to a new directory, with new names f

If else script in bash using grep and awk

I am trying to make a script to check if the value snp (column $4 of the test file) is present in another file (map file). If so, print the value snp and the va

tmux resizep not working as expected if run in shell command

I'm triyng to setup a tmux session from a bash script, without using any session manager like tmuxinator/tmuxp/... If I run this code #!/bin/sh tmux \ new

WARNING: `pyenv init -` no longer sets PATH when starting the terminal window

Goal: I am trying to install the "pyenv" on my Linux machine with the help of this article "https://realpython.com/intro-to-pyenv/" Expected Result: according t

JQ - Get specific values under a key based on variable filter

So for class I have to make an shell script (BASH) that uses JQ to display a superheroes secret identity and powers. It has been a pretty fun course. The script