This works:

*cd $PGARCH****{% raw -%}****while mapfile -t -n 20 ARCHIVE_LOGS && 
((${#ARCHIVE_LOGS[@]}))****{% endraw %}****do*

Or, if you had other Jinja variables to expand in that line, you could rewrite

*${#ARCHIVE_LOGS[@]}*

as

*${{ '{#' }}ARCHIVE_LOGS[@]}*



On 1/30/23 5:45 AM, dulhaver via Ansible Project wrote:
I am using the template module for a bash script


There is a problem with these lines

    cd $PGARCH
    {% raw %}while mapfile -t -n 20 ARCHIVE_LOGS && ((${#ARCHIVE_LOGS[@]})){% 
endraw %}
    do

they should be like below

    cd $PGARCH
    while mapfile -t -n 20 ARCHIVE_LOGS && ((${#ARCHIVE_LOGS[@]}))
    do

but factually the line break does not survive, hence the while loop, does not 
work

    cd $PGARCH
    while mapfile -t -n 20 ARCHIVE_LOGS && ((${#ARCHIVE_LOGS[@]}))do



I tried the change the .j2 to

    cd $PGARCH
    {% raw %}while mapfile -t -n 20 ARCHIVE_LOGS && ((${#ARCHIVE_LOGS[@]})){% 
endraw %}\n
    do

this prevent the line breack from disappearing but the '\n' remains in the 
target file on the remote

how would I approach this?


--
Todd

--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/14708166-5f98-17ce-8112-3c0ad6ad19ab%40gmail.com.

Reply via email to