Bash Scripting
Considerations
echo Hello, World. # prints out "Hello, World."
Conditionals (Decision Control Structure)
#!/bin/bash
#Setting a value to output
output=99
#Determine an action based on the output's value
if [ $output -eq 100 ] #if the output is equal to 100
then
echo "The calculation reaches 100%"
else
if [ $output -gt 100 ] #if the output is greater than 100
then
echo "The calculation is greater than 100%"
else #only option is that the output is less than 100
echo "The calculation is less than 100%"
fiLoops (Repetitive tasks)
Working with files (combining conditionals with Bash commands)
Working with filesystems (combining conditionals with Bash commands)
Last updated