# Escaping ampersand (&) in a string

**URL:** <https://forum.ansible.com/t/escaping-ampersand-in-a-string/21521>\
**Category:** Ansible Project\
**Created:** [May 23, 2016, 7:31am UTC](https://forum.ansible.com/t/escaping-ampersand-in-a-string/21521 "2016-05-23T07:31:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![parnesh.raniga](https://avatars.discourse-cdn.com/v4/letter/p/e0b2c6/32.png) [@parnesh.raniga](https://forum.ansible.com/u/parnesh.raniga)\
**Post date:** [May 23, 2016, 7:31am UTC](https://forum.ansible.com/t/escaping-ampersand-in-a-string/21521/1 "2016-05-23T07:31:40Z")

</div>

Hi All,

I am new to ansible and using it to create some cloud images. While for the most part ansible has been great and easy to use, one of the recurring problems I am having is how to correctly escape special characters. I have worked around other cases but now I need to generate a bash script on the fly and as part of that run a job in the background. I am using blockinfile to do this. What is the correct escape sequence for &?
