Difference between revisions of "IT-SDK-Shell"
Jump to navigation
Jump to search
Samerhijazi (talk | contribs) (→Examples) |
Samerhijazi (talk | contribs) (→Setting) |
||
| Line 3: | Line 3: | ||
=Setting= | =Setting= | ||
<pre class="code"> | <pre class="code"> | ||
| − | echo $SHELL ### To determine which shell you are currently using in the Terminal | + | echo $SHELL ### To determine which shell you are currently using in the Terminal. |
| − | + | -------------------------------------------- | |
| + | ls /opt/homebrew/Cellar/bash/5.2.15/bin/bash | ||
sudo bash -c 'echo /usr/local/bin/bash >> /etc/shells' | sudo bash -c 'echo /usr/local/bin/bash >> /etc/shells' | ||
chsh -s /usr/local/bin/bash | chsh -s /usr/local/bin/bash | ||
| + | </pre> | ||
| − | |||
=Examples= | =Examples= | ||
<pre class="code"> | <pre class="code"> | ||
Revision as of 17:31, 29 June 2023
Contents
Ref.
Setting
echo $SHELL ### To determine which shell you are currently using in the Terminal. -------------------------------------------- ls /opt/homebrew/Cellar/bash/5.2.15/bin/bash sudo bash -c 'echo /usr/local/bin/bash >> /etc/shells' chsh -s /usr/local/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
- https://www.bin-bash.de/scripts.html
- https://gist.github.com/mohanpedala/1e2ff5661761d3abd0385e8223e16425
#!/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[$@]}"