Variables are used in Shell Script to store temporary or permanent data such as strings or numbers. They can be defined and used in a variety of ways in a shell script.
To define a variable in a shell script, simply assign a value to it. Here’s an example of how to define a variable called “name”:
name=”Yan”
To use the variable in a later command in the script, simply use the variable name with a dollar sign ($) before it. Here is an example of how to print the value of the variable “name” using the “echo” command:
echo “Hello, $name!”