Why am I getting this 'bad substitution' error in my bash command?

前端 未结 1 986
一向
一向 2021-01-18 07:24

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 subs         


        
相关标签:
1条回答
  • 2021-01-18 07:39

    Your method only works in bash 4. Try this:

    echo $x | tr '[a-z]' '[A-Z]'
    
    0 讨论(0)
提交回复
热议问题