I'm trying to run an AWS CLI command for a resource with a ! in its name. I'm doing this from CentOS Docker instance running on my local device a MAC and if I run

echo "$SHELL" 

it says it is using bash

Using echo 'test!' works for returning the value but testing in my CLI command it does not work

aws autoscaling put-scheduled-update-group-action --auto-scaling-group-name temp_asg --scheduled-action-name 'test!' --start-time 2020-12-06T12:00:00Z --min-size 0 --max-size 1 --desired-capacity 0 --region eu-west-1 --output json

returns bash: !`: event not found

my AWS CLI version in the docker instance I'm running it from is aws-cli/1.16.251

1 Answer 1


I found that if I put it in a script it sees it as a string and it's only an issue running directly from the terminal/command prompt but not an issue when running from a script with the header/shabang #!/bin/bash My final goal for this is for it to be part of a script so this has resolved my issue.

Im still not 100% on the issue when directly in the terminal and don't know if it's specific to the shell I'm using?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.