ShellCheck is carping that my expression is not in double quotes when it really is; why?
9
votes
2
answers
1546
views
I'm writing a bash script with the AWS CLI and
shellcheck
is giving an error that I think is incorrect. I'd like to try to figure out why its carping.
Here's the code, and error message:
for server in $(${aws} ec2 describe-instances --query 'Reservations[].Instances[][].{Name: Tags[?Key==Name
].Value[] | }' --filters "Name=tag:Name,Values=${server_name}*" --output text);
^-- SC2016: Expressions don't expand in single quotes, use double quotes for that.
I can't get the code to line up correctly in the SO editor but the ^--
is pointing at the *
in the code. This part:
"Name=tag:Name,Values=${server_name}*"
The error provides a link to ShellCheck documentation for reference but when I double check everything, it looks like I'm in compliance. :D
I am guessing that the *
is throwing things off and I know that I can get around this by doing shellcheck -e SC2016
but I'm really wondering what might be causing shellcheck to carp.
Any ideas?
Asked by Michael J
(583 rep)
Mar 18, 2020, 08:22 PM
Last activity: Mar 19, 2020, 01:03 PM
Last activity: Mar 19, 2020, 01:03 PM