Reputation: 12488
#!/bin/sh
var="$1";
OUTPUT=$(echo ${$var,,});
echo $OUTPUT
I tried every possible combination, including escaping certain characters.
I just cant get shell to output my script argument lower cased.
Error:
createmodule.sh: 26: createmodule.sh: Bad substitution
Why is this?
Upvotes: 0
Views: 83
Reputation: 185053
There's a mistake, try this instead :
#!/bin/bash
var="$1"
OUTPUT=${var,,}
echo $OUTPUT
You have had a $
in excess.
As seen in discussion, never call scripts with sh script
if you are not sure that the wanted shell is really a sh
one. A better approach is to put the good shebang like #!/bin/bash
, and then chmod+x script.sh
and finally ./script.sh
Upvotes: 3