Category "bash"

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:

How to use while loop comparing 2 variables

#!/bin/bash touch dsa n=`ps aux | wc -l` i=2 while [ $i -le $n ]; do pid=`ps aux | awk 'NR==$i {print $2}'` ppid=`cat /proc/$pid/status | awk 'N

Bash script to connect to wifi using xdotool hangs after invoking firefox

I'm working on a bash script to connect to wifi using xdotool. It works until the script invokes firefox. Following error is logged after Firefox is invoked: /

Bash script to connect to wifi using xdotool hangs after invoking firefox

I'm working on a bash script to connect to wifi using xdotool. It works until the script invokes firefox. Following error is logged after Firefox is invoked: /

Script that will print HTTP headers for multiple servers

I've created the following bash script: #!/bin/bash for ip in $(cat targets.txt); do "curl -I -k https://"${ip}; "curl -I http://"${ip} done However I am not

failed to initialize sparse-checkout

I'm getting the below error when i try to clone a folder "banana" from git repository using sparse filter; git clone --depth 1 --filter=blob:none --sparse https

Convert Unix-Style Path to Windows

I have the same Bash script that I am running on Linux, Mac, and Windows (with Git Bash). How can I make sure that the path is converted to a Windows-style path

Create json from shell script output

I have a shell script version.sh in which i have code like. #!/bin/sh data = `lsb_release -a` echo $data it returned me the output like: Distributor ID: Ubuntu

Failed to capture the error message in linux

Failed to capture the response for the below command; URL="https://gsdfdsfithub.com/gitexpert/testGithub.git" > /dev/null git ls-remote $URL -q if [ $? -n

bash script youtube filtering

The goal is to be able to send video urls to two metube dockers. One just for YouTube and one for everything else but YouTube. This script is going to go in my

Trying to delete all shared memory and semaphore arrays in ipcs but get permission denied?

Can't find this anywhere online but when trying to delete semaphore arrays and shared memory using ipcrm -m id. I get this error permission denied for id (<i

Rendering terminal output in the browser

I have a file with a bunch of terminal logs captured with the screen utility. Here's a snippet: [A[0m[27m[24m[J[34m~[39m (base) [38;5;242mbase[39m [35mϱ