Category "bash"

Why am I getting gibberish result in Windows terminal?

I am trying to compare version in windows terminal. It works great in Git Bash but in Windows terminal it shows gibberish and wrong result? verlte() { [ "$

How to replace 00 with Na excluding first row & first column using bash in comma separated file

I'm working with GWAS data, My data looks like this: IID,kgp11004425,rs11274005,kgp183005,rs746410036,kgp7979600 1,00,AG,GT,AK,00 32,AG,GG,AA,00,AT 100,TT,AA,00

Can I pass a literal $ into a bash script from the command line?

I'm creating a bash script and I need to be able to accept a string as the first parameter. This string may contain the $ character. Script #/bin/bash pass="$1"

How to post multiple images to mastodon using api with bash curl

I'm starting to learn to use rest api via bash curl by writing a simple mastodon bot. I can attach multiple images using curl https://example.com/api/v1/statuse

Append lines separated by comma while preserving the existing new line

Bash script used: #!/bin/bash set -xv IS=$'\n' list=$(cat exlist_sample | xargs -n1) for i in $list; do echo "$i" | rev > slist echo "$i" >> z

Checking user info with multiple parameters

I have to print information about the user with the name given as a parameter. For example let's say ./script1.sh John should give me John Doe (username) -last

Generate github personal access token (PAT) by command line or SDK

I am looking for the command or SDK, such as python, to generate new personal access token (PAT) in Github, but I didn't see any API for it. https://docs.github

How to generate date in this format (2022-04-29T06:07:28.158Z) in linux

Looking for solution to generate date in the below format: 2022-04-29T06:07:28.158Z Have to use in bash script.

Rundeck inline bash spinner output

Have some bash test code that have a spinner. Code seems like this #!/bin/bash sleep 5 & pid=$! frames="/ | \\ -" while kill -0 $pid 2&>1 > /dev/n

a bash script that remove duplicates

This works wrong script should delete only copies, but this script deletes all files #!/bin/bash DIR=$1 if [[ -z "$DIR" ]]; then echo "Error: files dir is

Create a batch of 10 files with increasing numbers starting with the last or max number that already exists

I am trying to write a script so that each time you execute it, it creates a batch of 10 files with increasing numbers starting with the last or max number that

Append text in front of variable within the same line - bash

I have this example.text > cat example.text 10.10.44.11 10.10.44.20 xa1-Y xa2-Y xb1-Y xb2-Y xc1-Y xc2-Y xd1-Y xd2-Y and I have this command: srxa_host_list

MacOS BASH, Get output from networkQuality command running in background

I am trying to launch networkQuality command in the background and live fetch the first part of the output to the bash script launching it. First part I want to

How do I run 1 instance of rsync / rclone script using flock as a cron job?

I'm trying to run only one instance of my back up script as a cron job. I know I can do it with a function that checks if the process is running: if pgrep -x rc

Linux find xargs command grep showing path and filename

find /folder/202205??/ -type f | xargs head -50| grep '^Starting' There are 20220501 20220502 20220503 and so on folders... This command searches all first 50 l

running multiple processes, each with a different set of values for the environment variable

I have a number of jobs. Typically I start the jobs manually by opening a number of terminal windows, and in each terminal window setting certain environment va

Bash - How to rename files inside a directory based on names.txt

I'm sorry I can't provide the actual filenames for privacy reasons. names.txt contains several groups of lines separated by a single empty line. Each group pert

Multiple processes running bash on a ssh server

When I run the "ps" command, I can see all the processes I'm running, but for some reason, there are two identical processes(except for the PID ofc) running bas

How do I extract two different keywords from two different lines in a file in bash shell?

I have a file called data.txt. when I read the file, the content looks like the below. $ cat data.txt name: linuxVol id: 6 type: Linux dir excludes: .snapshot*

Why does xtrace show piped commands executing out of order?

Here's a simple reproducer: cat >sample_pipeline.sh << EOF set -x head