-
Book Overview & Buying
-
Table Of Contents
Linux Command Line and Shell Scripting Bible - Third Edition
By :
You can set your own variables directly from the bash shell. This section shows you how to create your own variables and reference them from an interactive shell or shell script program.
After you start a bash shell (or spawn a shell script), you're allowed to create local user-defined variables that are visible within your shell process. You can assign either a numeric or a string value to an environment variable by assigning the variable to a value using the equal sign:
$ echo $my_variable
$ my_variable=Hello
$
$ echo $my_variable
Hello
That was simple! Now, any time you need to reference the my_variable user-defined variable's value, just reference it by the name $my_variable.
If you need to assign a string value that contains spaces, you need to use a single or double quotation mark to delineate the beginning and the end of the string:
$ my_variable=Hello World
-bash: World: command not found
$
$ my_variable...
Change the font size
Change margin width
Change background colour