Store Data
Store values that can be reused throughout the script.
Shell Script · Variables
Shell Scripting · Lesson 6
Understand variables in shell scripting. System and user defined variables. Rules for naming variables. Using variables in real automation scripts.
Variables are used to store data that can be reused throughout a script. A variable can hold text, numbers, or command output.
In shell scripting, variables are created dynamically and do not require explicit data types.
Store values that can be reused throughout the script.
Change value once and reuse it everywhere.
Scripts behave dynamically based on variable values.
Variables are created by assigning a value without spaces around '='.
Variables can store numbers and be used in calculations.
Variables can be reassigned with new values.
Use readonly to make a variable constant.
Environment variables are available to child processes.
name and print it.age and update its value.readonly.env.Next lesson: User Input (read command)