Ref.
Setting
echo $SHELL ### To determine which shell you are currently using in the Terminal.
which bash
--------------------------------------------
ll /opt/homebrew/bin/bash -> ../Cellar/bash/5.2.15/bin/bash
sudo bash -c 'echo /opt/homebrew/bin/bash >> /etc/shells'
chsh -s /opt/homebrew/bin/bash
Examples
#!/bin/bash
read -p "How many Pods: " pods
if [[ $pods =~ [^0-9] ]]
then
echo "Sorry integers only"
fi
if [ -z "$pods" ]
then
pods=1
fi
echo "Setting Pods to ${pods}."
MIX
#!/bin/bash -euxo pipefail ###
set -e ### The option instructs bash to immediately exit if any command has a non-zero exit status.
set -u ### The option reference to any variable you haven't previously defined (with the exceptions of * and @) is an error, and causes the program to immediately exit.
set -x ### Enables a mode of the shell where all executed commands are printed to the terminal.
set -o pipefail ### This setting prevents errors in a pipeline from being masked.
Variablen
data_files=("file1.txt" "file2.txt" "file3.txt")
declare -x data_files
zip filename.zip "${data_files[$@]}"