Category "shell"

Run multiple python scripts concurrently

How can I run multiple python scripts? At the moment I run one like so python script1.py. I've tried python script1.py script2.py and that doesn't work: only t

Pipe a vim command after a shell command

I'm trying to make a key mapping in vim that (a) saves current file (b) performs a git action, using shell (c) quits current vim editor. I've tried the followi

Jenkins shell script returned exit code 1 when the searched string isn't exsist

I'm tring the following at Jenkins in aim to search strings of failures in jobs. This will run on daily basis. def sd = "2020" + "${env.START_DATE}" + "0000"

How to get last command run without using `!!`?

I'm trying to alias _! to sudo the last command, but I'm running into roadblocks. !! doesn't seem to work in my .zshrc file, and sed has given me repeated probl

Recursive copy of a specific file type maintaining the file structure in Unix/Linux? [closed]

I need to copy all *.jar files from a directory maintaining the folder structure of the parent directories. How can I do it in UNIX/Linux term

Suppressing summary information in `wc -l` output

I use the command wc -l count number of lines in my text files (also i want to sort everything through a pipe), like this: wc -l $directory-path/*.txt | sort -

How can I print a newline as \n in Bash?

Basically, I want to achieve something like the inverse of echo -e. I have a variable which stores a command output, but I want to print newlines as \n.

How to extract value from json contained in a variable using jq in bash

I am writing a bash script which has a json value stored in a variable now i want to extract the values in that json using Jq. The code used is. json_val={"co

Script file to run in android devices with help of the sh present in adb shell

I am facing a problem in writing a shell script for android devices to be run only on sh present in the device (/system/bin/sh). I have written the following s

How to check if a process is running inside docker container?

[Updated1] I have a shell which will change TCP kernel parameters in some functions, but now I need to make this shell run in Docker container, that means, the

How to check if a process is running inside docker container?

[Updated1] I have a shell which will change TCP kernel parameters in some functions, but now I need to make this shell run in Docker container, that means, the

'If' statements and one line Python scripts from the command line

Why do I receive a syntax error for the following one-liner Python code? python -c 'import re; if True: print "HELLO";' File "<string>", line 1 impo

How to check if ssh-agent is already running in bash?

I have a sample sh script on my Linux environment, which basically run's the ssh-agent for the current shell, adds a key to it and runs two git commands: #!/bi

Binding option left and right arrows to move by words in zsh command line

I'm using iTerm2 on Mac OSX 10.8 with an xterm key binding and zsh. I'd like zsh to use option left arrow and option right arrow to do the standard Mac binding

Difference between sh and Bash

When writing shell programs, we often use /bin/sh and /bin/bash. I usually use bash, but I don't know what's the difference between them. What's main difference

Running shell script in parallel

I have a shell script which shuffles a large text file (6 million rows and 6 columns) sorts the file based the first column outputs 1000 files So the pseu

Bash command line and input limit

Is there some sort of character limit imposed in bash (or other shells) for how long an input can be? If so, what is that character limit? I.e. Is it possible

How can I parse a YAML file from a Linux shell script?

I wish to provide a structured configuration file which is as easy as possible for a non-technical user to edit (unfortunately it has to be a file) and so I wan

Problem with passing parameters in a shell function

I have the following shell script. There is a deploy function, that is used later in the script to deploy containers. function deploy { if [[ $4 -eq QA ]]

bash script to check if the current git branch = "x"

I am very bad at shell scripting (with bash), I am looking for a way to check if the current git branch is "x", and abort the script if it is not "x". #!/