If I can do this in my bash shell:
$ STRING="A String"
$ echo ${STRING^^}
A STRING
How can I change my command line argument to upper case?
I tried:
GUARD=${1^^}
This line produces Bad substitution error for that line.
bashshell-script
If I can do this in my bash shell:
$ STRING="A String"
$ echo ${STRING^^}
A STRING
How can I change my command line argument to upper case?
I tried:
GUARD=${1^^}
This line produces Bad substitution error for that line.
Best Answer
Let's start with this test script:
This works:
This does not work:
This is because, on my system, like most debian-like systems, the default shell,
/bin/sh
, is not bash. To get bash features, one needs to explicitly invoke bash.The default shell on debian-like systems is
dash
. It was chosen not because of features but because of speed. It does not support^^
. To see what it supports, readman dash
.