为什么我的bash命令出现此“错误替换"错误? [英] Why am I getting this 'bad substitution' error in my bash command?
本文介绍了为什么我的bash命令出现此“错误替换"错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
运行此命令时,出现此替换错误"错误.我该怎么办?
when I run this I get this 'bad substitution' error. What can I do?
$ x="Hello World"
$ echo "$x"
Hello World
$ echo "${x^^}"
-bash: ${x^^}: bad substitution
我想全部使用大写字母.
I would like to have it in all upper case.
推荐答案
您的方法仅在bash 4中有效.尝试以下操作:
Your method only works in bash 4. Try this:
echo $x | tr '[a-z]' '[A-Z]'
这篇关于为什么我的bash命令出现此“错误替换"错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文