Difference between revisions of "IT-SDK-Shell"
Jump to navigation
Jump to search
Samerhijazi (talk | contribs) (→Setting) |
Samerhijazi (talk | contribs) (→Setting) |
||
| Line 4: | Line 4: | ||
<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. | ||
| + | which bash | ||
-------------------------------------------- | -------------------------------------------- | ||
| − | + | ll /opt/homebrew/bin/bash -> ../Cellar/bash/5.2.15/bin/bash | |
| − | sudo bash -c 'echo / | + | sudo bash -c 'echo /opt/homebrew/bin/bash >> /etc/shells' |
| − | chsh -s / | + | chsh -s /opt/homebrew/bin/bash |
</pre> | </pre> | ||
Revision as of 17:43, 29 June 2023
Contents
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
- 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[$@]}"