Category "bash"

Pass parameter from list in file

i'm struggling with this topic: I've a file with a list of IDs, something like this: 34 23 478 12579 342356 On the other side, i've a command that i want to ru

Creating mongoDB alias with .bash_profile on the cmder is not working

this is my first ever question. Okay.. Relevant to this problem : I am using cmder I am new to the terminal I am using a windows PC I'm following a tutorial on

GNU parallel - running command through multiple ssh jumphosts

I need to run commands on multiple hosts accessible via multiple jumphosts. I have a slf file ssh -i /root/.ssh/id_rsa -nJ jumphost1,user@jumphost2 user@worker1

Merge bash command(s)/simplification of a long command in bash

Hi I am making one script for which I would like it, that through one command it would be possible to make a more complex command or function. The problem is th

How to launch a new WSL bash window from an existing WSL bash window

I am struggling to figure out how to launch a new "command prompt" window via a bash command in WSL. The goal is to launch a second prompt preferably already in

Multiple Git push in one command

I've an application that requires to run git add/commit/push on each single file i'd like to push, in order to trigger a Gitlab Job on each. My problem is that

getopts & preventing accidentally interpreting short options as arguments

Here's a toy example that shows what I mean: while getopts "sf:e:" opt; foundOpts="${foundOpts}${opt}" ; done echo $foundOpts problem is that getopts isn't par

shell scripting nested loops. How to run inner loop along with the parent loop [duplicate]

I have two log files with the application names and the failed reasons , first.log Application 01 Application 02 Application 03 Applicatio

extract line if value in first column matches and value in second column not matches in another file in bash

I have 2 different files that look like this 61435320 rs10000085 12984967 rs10000091 32039123 rs10000150 and this: 61435320 rs1

find -exec - suppress errors only for find, but not for executed command

When running the find command, it may output "No such file or directory" errors. As answered to the find - suppress "No such file or directory" errors question

How to generate a symmetric key in C or C++ the same way this script does?

I am implementing Azure DPS (device provisioning service) for my ESP32-based firmware. The bash script I use so far is as follows (where KEY is the primary key

Catalina bash shopt direxpand missing

I'm new to macOS coming from Windows and Linux. I want to use bash and found how to upgrade bash on Catalina, version now: GNU bash, version 5.0.18(1)-release (

How to make a script to check if a package is installed and install it if not?

I am trying to make a bash script for work that would check the system for a handful of installed packages and if it dosent find them, install them. I have atta

IP address in condition statement bash profile

below ism y code if [ ip add show tun0 2>/dev/null ] ; then export http_proxy="http://127.0.0.1:2123" fi But when i do echo after conencting echo $http_

git commit: pre-populate commit subject but still prompt for a commit message [duplicate]

Let's say I'm working on a branch and I run git commit. I am then taken to the commit message prompt where I may enter a commit subject and m

How to read each cell of a column in csv and take each as input for jq in bash

I am trying to read each cell of CSV and treat it as an input for the JQ command. Below is my code: line.csv | Line | |:---- | | 11 | | 22 | | 33 | Cod

How to find the amount of time taken during Iterative loop?

Trying to subtract two times down to the nanosecond in shell. declare start function handler() { count=$1 if [ "$1" -le 0 ]; then echo "Not a valid entry"

What is the result supposed to be of the command "cut -f 1,2 list.txt"?

I tried using the command cut -f 1,2 list.txt on a list but for some reason the output of the list it gives me remains the same, I'm not seeing any difference.

Copying and pasting code into the Nodejs REPL using shell script

I want to copy a javascript code snippet into Nodejs REPL using shell script. For example sum.sh node // Here REPL open, I want copy below codes to this REPL

In Azure Pipelines how to post a dynamic, multi-line comment generated in a previous step using GitHubComment task?

In an Azure Pipeline, the following will post a multi-line comment to a GitHub PR: stages: - stage: MyStage jobs: - job: CommentOnPR steps: