我无法从互联网上找到这些信息,是否有可能声明一个最终的常量变量,其值在初始化后不会改变?
I believe you can do something like:
readonly DATA=/usr/home/data/file.dat
You can also do:
declare -r var=123
readonly FOO=bar
In bash you can mark a variable read only by declaring it via the builtin readonly like so:
bash
readonly
readonly CONSTVAR=value