Top "Shell" questions

The term 'shell' refers to a general class of text-based interactive command interpreters most often associated with the Unix & Linux operating systems.

How to check if a variable is set in Bash?

How do I know if a variable is set in Bash? For example, how do I check if the user …

bash shell variables
Check existence of input argument in a Bash shell script

I need to check the existence of an input argument. I have the following script if [ "$1" -gt "-1" ] then echo …

bash shell
Loop through an array of strings in Bash?

I want to write a script that loops through 15 strings (array possibly?) Is that possible? Something like: for databaseName in …

arrays bash shell
How to use SSH to run a local shell script on a remote machine?

I have to run a local shell script (windows/Linux) on a remote machine. I have SSH configured on both …

shell ssh sysadmin remote-execution
How to mkdir only if a directory does not already exist?

I am writing a shell script to run under the KornShell (ksh) on AIX. I would like to use the …

shell scripting ksh aix mkdir
Extract substring in Bash

Given a filename in the form someletters_12345_moreleters.ext, I want to extract the 5 digits and put them into a …

string bash shell substring
How do I iterate over a range of numbers defined by variables in Bash?

How do I iterate over a range of numbers in Bash when the range is given by a variable? I …

bash shell for-loop syntax
In the shell, what does " 2>&1 " mean?

In a Unix shell, if I want to combine stderr and stdout into the stdout stream for further manipulation, I …

bash shell unix redirect
How to specify the private SSH-key to use when executing shell command on Git?

A rather unusual situation perhaps, but I want to specify a private SSH-key to use when executing a shell (git) …

git bash shell ssh
Running shell command and capturing the output

I want to write a function that will execute a shell command and return its output as a string, no …

python shell subprocess