# multiple variables

**URL:** <https://forum.ansible.com/t/multiple-variables/23043>\
**Category:** Ansible Project\
**Created:** [November 16, 2016, 4:45pm UTC](https://forum.ansible.com/t/multiple-variables/23043 "2016-11-16T16:45:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luigi\_Crozzoli](https://avatars.discourse-cdn.com/v4/letter/l/c77e96/32.png) [@Luigi\_Crozzoli](https://forum.ansible.com/u/Luigi_Crozzoli)\
**Post date:** [November 16, 2016, 4:45pm UTC](https://forum.ansible.com/t/multiple-variables/23043/1 "2016-11-16T16:45:09Z")

</div>

Is there a way to register two or more variables echoed from shell script?  
I want to do something like this:

script.sh  
A=“hello”  
B=“world”  
echo $A  
echo $B

ROLE  
shell: "{{ script }} "  
register: result  
ignore\_errors: False

- name: debug  
debug: var={{ result1 }} --\>of echo 1 → hello  
debug: var={{ result2 }} --\>of echo 2 → world

Is there some other way to do what I’m trying to do there?

thx

---

<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:** [November 16, 2016, 5:57pm UTC](https://forum.ansible.com/t/multiple-variables/23043/2 "2016-11-16T17:57:24Z")

</div>

Your code would not run since it has some errors.

But you can get the first line from a output like this:  
&nbsp;&nbsp;&nbsp;- debug: var=result.stdout\_lines.0

and the second line like this:  
&nbsp;&nbsp;&nbsp;- debug: var=result.stdout\_lines.1
