So right now I am writing a bash script in which I am filtering by aws --filters
flag. I have stored the value in a variable so that I can use it with multiple aws commands.
# This is the variable that I want to access with multiple aws commands
aws_filter_args="--filters Key=tag-key,Values=Environment Key=tag-value,Values=temp"
# This is the command from which I am getting this error
# Unknown options: --filters "Key=tag-key,Values=Environment" "Key=tag-value,Values=temp"
aws secretsmanager --profile=source list-secrets --max-items 10000 "$aws_filter_args"
One thing I have done the same thing with the --profile
arg and it's working fine. Any idea what I am doing wrong?
Thanks for the help @tshiono, solution you provided works! Reposting here.
Store the args in an array as: aws_filter_args=("--filters" "Key=tag-key,Values=Environment" "Key=tag-value,Values=temp") then invoke with aws secretsmanager --profile=source list-secrets --max-items 10000 "${aws_filter_args[@]}"