Category "bash"

How to read user interaction of rm -I command and store in a variable shell scripting

so this function basically runs similar to rm -i command and the arguments are passed while executing (eg. bash script_Name test.txt). rm -i $file does ask me t

Fixing PATH for Python libraries using Bash

I am attempting to install some Python libraries by executing variations of the following command in Bash: pip install --user -U numpy I installed Python3 usin

How to remove a single command from bash autocomplete

How do I remove a single "command" from Bash's auto complete command suggestions? I'm asking about the very first argument, the command, in auto complete, not a

Script to create swap partition fails when running automatically

I am creating a cluster of machines in AWS (Amazon Linux 2) using terraform by utilizing the user_data argument under the aws_instance resource. Part of the scr

Why assignment inside loop not influence the global value?

I have next data source and code: data: 1 2 3 test.sh: s=0 cat data | while read oneline do v=$(($oneline)) s=$(($s+$v)) echo $s done echo "Final:

Write a shell script to find the largest among three numbers. Get user inputs and display the result

Write a shell script to find the largest among three numbers. Get user inputs and display the result. Sample input 1: 10 20 30 Sample output 1: 30 is lar

sed replace backslash double quote with single quote

I would like to take the following: echo "'{\"apiVersion\":\"apps/v1\", \"kind\":\"two\"}'" And end up with the following via using SED: {'apiVersion':'apps/v1

Restart terminal without closing on MacOS

How to restart my current MacOS terminal session without closing the window? In Linux I use exec bash but it does not work in this environment. I made a few ch

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 (