Introduction Bash Scripting for Linux System Administrator
02 Feb 2021 #scriptVariables
site="davide"
echo $name
echo ${name} #!/bin/bash
# Bash example script
site="fixerupper"
echo "What is your name?"
read name
echo "Hi there $name"
echo "Welcome to $site Website!"If / then
if [[ some_test ]]
then
<commands>
fi #!/bin/bash
# Bash example script
read -p "What is your name? " name
if [[ -z ${name} ]]
then
echo "Please enter your name!"
else
echo "Hi there ${name}"
fiLoops (for, while, until)
for var in ${list}
do
your_commands
donewhile [ your_condition ]
do
your_conditions
doneuntil [ your_condition ]
do
your_commands
donecontinue — stop the current iteration of the loop and start the next iteration. break — end the loop straight away.