The misunderstanding is that environment variables are used only by shells - they are not. No attributes, including readonly, integer, and arrays, can be exported to the environment block. Environment variables can be read in any language, C, C ++, Perl, Java, Python, PHP, etc. They also exist on Windows.
So, how can another language support Bash specific attributes? All environment variables are converted to strings, with the exception of Bash, where array values ββare not exported at all.
The Korn shell exports only the first item. ksh93 also performs some exec operation to save the variable attributes exported to children of the Korn shell.
By the way, it is considered bad practice to use UPPERCASE for variable names, as they may interfere with those used by the shell. In addition, in Bash 3, the name STRING has problems exporting (fixed in Bash 4).
cdarke
source share