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[] | [0]}' --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?
*
but above it is `Name`'Reservations...
part of the code. thanks.