Creating and setting variables within a script (or shell prompt) is fairly simple. The syntax is:
varName=someValue export varName export vech="Bus" echo "$vech"
How do I unset a variable in bash?
Use unset command to delete the variables during program execution. It can remove both functions and shell variables. The syntax is:
To unset the $vech, enter:
A note about readonly variables
Please note that some variables cannot be unset if they are defined as readonly by the system or sysadmin:
-bash: unset: BACKUPDIR: cannot unset: readonly variable
You can define your readonly variables using the following syntax:
declare -r BACKUPDIR="foo"
How do I unset a shell function on bash?
The syntax is as follows to treat each varName as a shell function:
unset -f varName unset -f tarhelper
For more info, type:
$ help unset
$ help declare
$ man bash