Category "bash"

How can I pipe output, from a command in an if statement, to a function?

I can't tell if something I'm trying here is simply impossible or if I'm really lacking knowledge in bash's syntax. This is the first script I've written. I've

why does hexdump reverse the input when given "\xFF\x00"? [duplicate]

Why does hexdump print 00ff here? I expected it to print ff00 , like it got in stdin, but $ printf "\xFF\x00" | hexdump 0000000 00ff 0000002

Python Socket Listener error with connecting to bash reverse shell - `bash: cannot set terminal process group (1057): Inappropriate ioctl for device`

Python Socket Listener error with connecting to bash reverse shell - bash: cannot set terminal process group (1057): Inappropriate ioctl for device I am workin

Get docker mysql root password in a variable

I created a mysql docker container mysqlcontainer using following command: docker exec -it mysqlcontainer -d mysql/mysql-server I run docker logs mysqlcontaine

Google Cloud Shell - Echo two Variables does not work as expected [duplicate]

Hi I wanted to write a simple bash script to execute some google cloud commands using the google cloud shell Terminal. Doing this I got always

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