I have a following loop that works well:
function uppercase_all_letters() {
for filename in *;
do echo "${filename^^}";
done;
}
How do I provide "${filename^^}"
as a parameter to the function?
I tried it the usual well (SUBSTITUTION="${filename^^}"
) but then Bash reports:
./test.sh: line 26: ${filename^^}: bad substitution
bash
, but possibly withdash
(/bin/sh
on some Linuxes) orzsh
, althoughdash
would have saidBad substitution
(upper caseB
) and would also have complained about the non-standard function definition.bash
is using that error format; eg.echo '${foo&&}' | bash
=>bash: line 1: ${foo&&}: bad substitution
. The OP is probably using some older version of bash which didn't support yet that syntax.bash
that you use? The^^
thing was added inbash-4.0-alpha
.$SUBSTITUTION
(and which is what probably causes the error) was shown.