gpt4 book ai didi

bash - 在没有事先赋值的情况下声明和设置变量

转载 作者:行者123 更新时间:2023-12-04 18:45:02 25 4
gpt4 key购买 nike

给定一个标准的 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com