Category "bash"

quoting in bash with ssh and grep

I don't get why this doesn't work: filesToInclude="$(ssh -t $host ls -t /var/log/*.LOG | sort | egrep -A6 "$LastBootUp" | tr '\n' '[:space:]' | tr -s [:space:]

CURL 403 Forbidden Error but working good in POST man request

Issue: Curl command not giving response with 200 status but If I send request from postman its working fine Here I have shared the CURL command. Any suggestion

'git status' yields different results in git bash (Windows 10) an WSL2 bash

I work on Windows 10 with WSL2. I initialized a git repo in git bash (Windows) and everything works fine (commit, push etc.). git status # on Windows, git b

Not able to assign value to variable$i in shell script

abc=( "one" "two" "three" ) for((i=0; i<${#abc[@]}; i++)) { xyz$i="hello" --- this is giving me error as no such file or directory eval xyz$i="hel

Stop bash if any of the functions fail in parallel

I have a BASH to run 3 functions in parallel in my BASH. functionA () { ...... my command || { echo "ERROR!!" >> $LOG_FILE

How to check if supervisor process is running or stopped using bash script

I run multiple supervisor processes sometimes due to server overload some processes Stop indefinitely until you manually restart them. Is there a way I can writ

how to use python variables in bash script inside python script

I am trying to use my python variables inside the bash script in the python script as below... import os import submodule URL="http://wmqa.blob.core.windows.net

BASH | can not get redirected URL from URL that in CSV file by cURL

I need to get redirected URL from the origin URL that gets in a CSV file, but not as my expect, it only return origin URL, not redirected URL how can I resolve

Automatically solve rm cannot remove path : device or resource busy error

I am trying to remove a directory /path/to/dir using the rm -rf command. Unfortunately I get the error rm: cannot remove '/path/to/dir/.nfsdda293a660f276ca00000

~/.bashrc change PS1 with color converts newline into carriage return first newline

I changed my prompt as: c=$(basename $CONDA_DEFAULT_ENV) export PS1='[\h] -\e[0;36m$c\e[0;37m (\W) 🤞 \e[0;52m' In ~/.bashrc. The first newline

Get rid of single quotes from the substituted string within sed command in Python

I have a text file 1.txt which has following content: module abc I am trying to generate multi-line string that I need to add before module abc line in 1.txt.

Reading filename using regexp in Bash

I am writing a bash script that calls an external program which generates a zip file of the form ########.zip which the '#'s# can be any decimal digit. There i

Find Binary in a dir of text files Python or Bash

I have a series of log files that are all text. If a certain error happens it results in binary being inserted in the text. I want a Python or Bash script that

How to raise error in bash if a dir does not match certain permissions?

How can I raise an error in bash if a directory at some path does not match the below permissions? u=rwX,g=rwX,o=rwX

"Declare" loop creates output for only one of the variables

I have written a script to create a loop for a software I'm running: #!/bin/bash declare -a pops=("pop1" "pop2" "pop3") for target in "${pops[@]}"; do while I

It doesn't pick up the variable correctly in subprocess.call (python)

I am creating a telegram bot to send the information that I request to the app. When I run the code below it works fine except for the last part, when it does t

How to sort a specified column in l、Linux

This is my two column sequence, I want to combine them into 1 column and sort them in Linux, but I don't know how to write the shell script to handle them.

How to use sshpass without TTY on a Node.JS backend?

I am running the following in a script: pubkey=$(gpg2 --verbose --export-ssh-key $EXPORT_THIS_ID) sshpass -p$REMOTE_PASS ssh -o IdentitiesOnly=yes -o StrictHost

Get exit status of a process in bash

I have a c++ executable named Test. I want to find out the GetExitCodeProcess() code when the execution is completed. I can find out the status code by writin

Update global variable from while loop

Having trouble updating my global variable in this shell script. I have read that the variables inside the loops run on a sub shell. Can someone clarify how thi