Quote:
Originally Posted by hocheetiong
2. Now i assign var1 as readonly variable, than if i really want to change or remove this variable how to do?
|
Don't declare it as readonly. Once you've set a variable as readonly you can't do anything but kill the shell.
The only chance is to use readonly variables in a subshell. In this case the variable is local to the subshell and the parent shell is not aware of its existence:
Code:
( var=3; readonly var; echo $var )
var=5
echo $var