Bash variables and functions
Explore the concept of Bash variables and functions, including setting and reading variables, different variable types, and using functions to organize code in shell scripts. Understand how to declare local and global variables and apply these concepts to create practical scripts.
We'll cover the following...
We'll cover the following...
A variable is a temporary store for a piece of information. There are two actions we may perform for variables: first - setting a value for a variable, second - reading the value for a variable. To read the variable we place its name preceded by a $ sign. To learn more, let’s create a shell script that will backup the home directory into a zipped (tar.gz) file.
Here the variable filename ...