Hi,
I am new to shell programming. I just wanted to know if I set a variable to readonly. How do I revert it back to normal.
name="some_name"
readonly name
Now I want to make name variable back to it normal, on which I can perform write operation too.
Thanks
You cannot mark it un-readonly, you are stuck with it until the process that created it is gone. readonly is used on variables like TMOUT, which are set in /etc/profile and meant to have "forever" duration for any user that logs in.
This is what POSIX says about readonly:
readonly
For scripting purposes you would have to seed a variable with a new name and continue the script with the new name.
new_var="${name}"
Obviously if a special variable like $PATH was read-only, the new variable would not inherit the special meaning.