gpt4 book ai didi

arrays - 在 bash 数组 : pathname expansion and side effects mentioned in the manual 上取消设置命令

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

我在 bash manual 看到了这个说法并且不确定如何连接 unset 命令、路径名扩展和副作用。

The unset builtin is used to destroy arrays. unset name[subscript] destroys the array element at index subscript. Care must be taken to avoid unwanted side effects caused by pathname expansion.



是否有一个示例说明了与 this manual 的路径名扩展配对的副作用?正在谈论?

最佳答案

这意味着你必须引用它:

unset 'avar[index]'
unset "avar[$index]"
unset 'avar[1234]'
[]也是路径名扩展的有效模式

所以如果你有一个像 avar1 这样的文件,这将尝试取消设置 avar1相反:
unset avar[12]

关于arrays - 在 bash 数组 : pathname expansion and side effects mentioned in the manual 上取消设置命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18540672/

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