gpt4 book ai didi

bash - 为什么我的 bash 命令会出现 'bad substitution' 错误?

转载 作者:太空宇宙 更新时间:2023-11-04 11:47:13 25 4
gpt4 key购买 nike

当我运行它时,我得到了这个“错误的替换”错误。我能做什么?

$ x="Hello World"
$ echo "$x"
Hello World
$ echo "${x^^}"
-bash: ${x^^}: bad substitution

编辑:我想全部大写。

最佳答案

你的方法只适用于 bash 4。试试这个:

echo $x | tr '[a-z]' '[A-Z]'

关于bash - 为什么我的 bash 命令会出现 'bad substitution' 错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57251823/

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