Category "sh"

Get homebrew to run a script after 'brew install x' or 'brew uninstall x'

I want to automate having a file that tracks all my installed brew packages. I can do this manually with brew list > somefile, how ever I want this process t

How to make the ssh with -o StrictHostKeyChecking=no running on the docker in order to ssh the host work without exiting the script execution?

I have a script, that is running inside the docker container some actions we need for some internal debugging purposes: set -eu echo "Starting i/o test for hos

Merge bash command(s)/simplification of a long command in bash

Hi I am making one script for which I would like it, that through one command it would be possible to make a more complex command or function. The problem is th

Terminal error: zsh: permission denied: ./startup.sh

I am running a command ./startup.sh nginx:start and I am getting this error message zsh: permission denied: ./startup.sh why could this be happening?

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

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

How to find file path to a bash file when the folder is renamed or moved to a new drive?

I've made an executable jar file for a terminal game that can be opened by typing java -jar name.jar in the Terminal. Then I made a .sh file inside the same fol

How to be explicit about intentional word splitting?

I'm running shellcheck on my scripts and often get this warning (which in this case is correct, because cd foo bar baz makes no sense): cd ${SOME_DIR} || exit 1

shell errors running php exec

I have a PHP script that executes a shell command to find the common items between two files given. This is the beginning of my PHP script: $E7Bonded_File = "

Why does this script works on one machine but not on the other? MacOS Catalina

I have this shell script which works on my machine just fine. To test the script I have a VM with the same OS Version, MacOSCatalina. On the "real machine" the

print bash script comments when bash is executed

Assuming I have a bash script test.sh: #!/bin/bash # Comment 1 echo "Hello world" # Comment 2 echo "Hi there" I know after making the bash script executable

list of logged in unique users in linux

I am working in linux environment as a non root user. I am using users command to get the logged in users users But it returns the user names multiple times

Confirming Shell Script Input

I'm writing a script to preform a repetitive task that only changes basic values and locations such as user name. I've written up code that prompts for a usern

How to declare a var in bash without it replacing a var in a different file

I have 2 files file1 and file2. Inside file1 I declare a var, x=1. In file2 I make a var x=2. If I run file one then file two, and then in the shell echo x, I g

iterating a list of strings with whitespace in POSIX sh

I have two lists of strings (with whitespace in each string), and want to read them one by one. The length of the strings are the same, so I get the length of o

How to run a cron job inside a docker container?

I am trying to run a cronjob inside a docker container that invokes a shell script. Yesterday I have been searching all over the web and stack overflow, but I c

I just assigned a variable, but echo $variable shows something else

Here are a series of cases where echo $var can show a different value than what was just assigned. This happens regardless of whether the assigned value was "do

Jenkins does not recognize command sh?

I've been having a lot of trouble trying to get a Jenkinsfile to work. I've been trying to run this test script: #!/usr/bin/env groovy node { stage('Build

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