<p>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.</p>
<p>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?</p>

CC BY-SA 4.0
2020-11-30T18:39:23.973Z
2020-11-30T18:39:23.973Z
doug
<p>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</p>
<pre class="lang-bash prettyprint-override"><code>echo &quot;$SHELL&quot; 
</code></pre>
<p>it says it is using bash</p>
<p>Using echo 'test!'  works for returning the value
but testing in my CLI command it does not work</p>
<pre><code>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
</code></pre>
<p>returns
bash: !`: event not found</p>
<p>my AWS CLI version in the docker instance I'm running it from is
aws-cli/1.16.251</p>

<amazon-web-services><aws-cli>
In the AWS CLI how do I treat a special character as a string?
doug
# In the AWS CLI how do I treat a special character as a string?

(Asked by: username_0 on 2020-11-30)

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

**Tags:** amazon-web-services, aws-cli


---

## 1 answers

### Answer by username_0 on 2020-11-30. Score: 0

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?


---

