# How to pass multiple special symbols with shell module?

**URL:** <https://forum.ansible.com/t/how-to-pass-multiple-special-symbols-with-shell-module/24069>\
**Category:** Ansible Project\
**Created:** [March 27, 2017, 11:10am UTC](https://forum.ansible.com/t/how-to-pass-multiple-special-symbols-with-shell-module/24069 "2017-03-27T11:10:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bhavin\_Parmar](https://avatars.discourse-cdn.com/v4/letter/b/7ab992/32.png) [@Bhavin\_Parmar](https://forum.ansible.com/u/Bhavin_Parmar)\
**Post date:** [March 27, 2017, 11:10am UTC](https://forum.ansible.com/t/how-to-pass-multiple-special-symbols-with-shell-module/24069/1 "2017-03-27T11:10:55Z")

</div>

I am using shell command to execute sed output piped to cut. Task in a playbook is as follow:

tasks:

- name: “Task 1: Fetch inv”  
shell: ‘/bin/sed -n ‘/’{{ group }}’/,/^$/p’ {{ var\_file }} | cut -d’=’ -s -f2’  
register: scriptout
- debug: var=scriptout

I have tested manually from the command prompt, it is working fine. But when running in an Ansible gives following error:

ERROR! Syntax Error while loading YAML.

The error appears to have been in ‘/home/ansible/playbooks/my.yml’: line 15, column 31, but may  
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

#shell: ‘{{ linux\_script }} {{ var\_file }} {{ group }}’  
shell: ‘/bin/sed -n ‘/’{{ group }}’/,/^$/p’ {{ var\_file }} | cut -d’=’ -s -f2’  
^ here  
We could be wrong, but this one looks like it might be an issue with  
missing quotes. Always quote template expression brackets when they  
start a value. For instance:

with\_items:

- {{ foo }}

Should be written as:

with\_items:

- “{{ foo }}”

Please, someone can help me to understand the concept of escape characters should be used? Or pass the special characters as a string? and how to achieve the same?

---

<div class="post-metadata">

**Author:** ![Bhavin\_Parmar](https://avatars.discourse-cdn.com/v4/letter/b/7ab992/32.png) [@Bhavin\_Parmar](https://forum.ansible.com/u/Bhavin_Parmar)\
**Post date:** [March 27, 2017, 3:01pm UTC](https://forum.ansible.com/t/how-to-pass-multiple-special-symbols-with-shell-module/24069/2 "2017-03-27T15:01:03Z")

</div>

{{ group }} and {{ var\_file }} are variables.
