给定一个标准的 bash 环境,以下行为是否普遍预期?
~ $ declare testa
~ $ declare -p testa
bash: declare: testa: not found
在撰写本文时,不同操作系统中不同 bash 的输出在给定情况下似乎存在差异(此处未显示)。
此外,是否有任何明确的 bash API 手册、引用或其他文档涵盖这种情况?
最佳答案
这被认为与
the bash 4.4 relase, Entry "f. The `-p' option to declare and similar builtins will display attributes for named variables even when those variables have not been assigned values (which are technically unset)."
关于bash - 在没有事先赋值的情况下声明和设置变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49665313/