1. Creating variables
Variables are case sensitive and capitalized by default. Giving local variables a lowercase name is a convention which is sometimes applied. However, you are free to use the names you want or to mix cases. Variables can also contain digits, but a name starting with a digit is not allowed.
To set a variable in the shell, use
VARNAME="value"
Putting spaces around the equal sign will cause errors. It is a good habit to quote content strings when assigning values to variables: this will reduce the chance that you make errors.
2. Exporting variables
A variable created like the ones in the example above is only available to the current shell. It is a local variable: child processes of the current shell will not be aware of this variable. In order to pass variables to a subshell, we need to export them using the export built-in command. Variables that are exported are referred to as environment variables. Setting and exporting is usually done in one step:
export VARNAME="value"
A subshell can change variables it inherited from the parent, but the changes made by the child don't affect the parent.
Watch video Linux Bash Guide -- echo : Creating variables and Exporting variables online without registration, duration hours minute second in high quality. This video was added by user WPJ852 06 March 2017, don't forget to share it with your friends and acquaintances, it has been viewed on our site 231 once and liked it 0 people.