How do I declare a constant in shell script?
BashShellBash Problem Overview
I can't find this information from the internet, is it not possible to declare a final constant variable whose value will not change after first initialization?
Bash Solutions
Solution 1 - Bash
I believe you can do something like:
readonly DATA=/usr/home/data/file.dat
You can also do:
declare -r var=123
Solution 2 - Bash
Solution 3 - Bash
In bash
you can mark a variable read only by declaring it via the builtin readonly
like so:
readonly CONSTVAR=value