Karellism

Variables Summary

Dec 17th, 2020 (edited)
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!

Variables Summary

$1, $2, ...
The first, second, etc command-line arguments to the script.
variable=value
To set a value for a variable. Remember, no spaces on either side of =
Quotes " '
Double will do variable substitution, single will not.
variable=$( command )
Save the output of a command into a variable
export var1
Make the variable var1 available to child processes.


Important Concepts!

Formatting
The presence or absence of spaces is important.
Manageability
If a particular value is used several times within a script (eg a file or directory name) then using a variable can make it easier to manage.

Add Comment
Please, Sign In to add comment