Jump to: navigation, search

Tutorial10: Shell Scripting - Part 1

11 bytes added, 10:19, 3 September 2020
Using Variables in Shell Scripts
'''Environment Variables'''
[[Image:environment.png|thumb|right|500px|Examples of using '''Environment''' and '''User Defined''' variables.]]Shell '''environment variables ''' shape the working environment whenever you are logged in Common shell. Some of these variables are displayed via Linux commands in the diagram displayed on the right-side.<br>(you can issue the pipeline command '''set | more''' to view all variables)
Placing a dollar sign ('''$''') prior to the variable name will cause the variable to expand to the value contained in the variable.
'''User Defined Variables'''
'''<b>User-defined variables'''</b> are variables which can be '''created by the user''' and exist in the session. This means that no one can access user-defined variables that have been set by another user,<br>and when the session is closed these variables expire.''<br>'''Reference:'''
Data can be stored and removed within a variable using an equal sign.<br>The '''read''' command can be used to prompt the user to enter data into a variable.<br>Refer to the diagram on the right-side to see how user-defined variables are assigned data.

Navigation menu