Learn Bash Scripting
Take a minute to review what you’ve learned about bash scripting.
- Any command that can be run in the terminal can be run in a bash script.
- Variables are assigned using an equals sign with no space (
- Variables are accessed using a dollar sign (
- Conditionals use
- Three types of loops can be used:
- Bash scripts use a unique set of comparison operators:
- Not equal:
- Less than or equal:
- Less than:
- Greater than or equal:
- Greater than:
- Is null:
- Input arguments can be passed to a bash script after the script name, separated by spaces (myScript.sh “hello” “how are you”).
- Input can be requested from the script user with the
- Aliases can be created in the
Our completed script is in the code editor. Feel free to edit it to make it your own.
- ask the user for different greetings
- add more than two greetings
- add more conditions to adjust the greetings over time