Lab 8
Lab 8
Lab 8
Outline 1 Conditionals in Bash Scripting
2 Operators in Bash Scripting
3 Loops in Bash Scripting
4 Useful Resources
1 Conditionals in Bash Scripting
Conditionals in Bash Scripting
• Conditionals in bash follow this syntax “if [ expression ]; then ... fi”.
Syntaxes like “else” and “elif” are also supported:
2 Operators in Bash Scripting
Operators in Bash Scripting
• Like C, the logical operators “&&” and “||” are also supported in bash.
• For strings, we only used “=”, but other operators are supported too like
“!=”, “<”, “>”, “-n $var” which checks if $var is not empty, and
“-z $var” which checks if $var is empty.