# newline characters in shell commands

**URL:** <https://forum.ansible.com/t/newline-characters-in-shell-commands/25659>\
**Category:** Ansible Project\
**Tags:** ansible-project\
**Created:** [October 2, 2017, 6:05pm UTC](https://forum.ansible.com/t/newline-characters-in-shell-commands/25659 "2017-10-02T18:05:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [October 2, 2017, 6:05pm UTC](https://forum.ansible.com/t/newline-characters-in-shell-commands/25659/1 "2017-10-02T18:05:51Z")

</div>

I can't confirm this behavior against Kubuntu, in my test I get to lines in the file.

In Ansible shell is using /bin/sh, on Kubuntu /bin/sh is a link to dash. Since echo is a builtin on most shells if not all shell, they may differ some. So it depends on you distribution and what /bin/sh is actually running.

To avoid this problem you could use the Ansible's copy module instead  
ansible ubtest -m copy -a 'dest=/tmp/foo content="line 1\nline 2"'
