Category "bash"

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ϱ

Convert text to associative array in bash script [closed]

Hi I am new to bash scripting. I have a text as shown below input = {'A': '1' 'B': '2' 'C': 'Associative_Array'} I want to convert the above t

Azure Devops Get a repositoryId by using repository name

I am writing a BASH script, where its creating an azure repo and then pushing code. post this step it will go-ahead and create an azure pipeline via azure-pipel

How to check if /tmp and /proc filesysystems are mounted in a chrooted environment?

I have already tried mounting the filesystems without checking like this: sudo -- mount -t proc /proc $chroot_dir/proc sudo -- mount --bind /tmp $chroot_dir/tmp

Show call stack in Bash

To start with, I do not know if this is something trivial and common knowledge; I don't know, so am asking here. I am running a 3rd party app and trying to nai

Extract a string between double quotes from the 6th line of a file in Unix and assign it to variable

Newbie to unix/shell/bash. I have a file name CellSite whose 6th line is as below: btsName = "RV74XC038", I want to extract the string from 6th line that i

How to wait in bash script to subprocess, if one of them failed so stop everyone

How to wait in bash script to subprocess and if one of them return exit code 1 so I want to stop all subprocess. This is what I tried to do. But there are a som

Looping through all files in a directory [duplicate]

I want to write a shell script that will loop through all the files in a directory and echo "put ${filename}". Can anyone point me in the righ

Getting the error: bash: (program): cannot execute binary file: Exec format error, on both 32-bit and 64-bit Windows

There is a program developed for linguistic research (http://people.csail.mit.edu/mcollins/code.html). When I try to run the parser using Git bash terminal on W

How to login to bash with current user, and the user's .bashrc file, in jupyterlab?

I have a configuration file setup in .bashrc which I would like to apply to all terminals opened automatically in my jupyterlab. Currently jupyterlab terminal