Quantcast
Channel: Print array elements on separate lines in Bash? - Stack Overflow
Viewing all articles
Browse latest Browse all 9

Answer by wuxmedia for Print array elements on separate lines in Bash?

$
0
0

I tried the answers here in a giant for...if loop, but didn't get any joy - so I did it like this, maybe messy but did the job:

 # EXP_LIST2 is iterated     # imagine a for loop     EXP_LIST="List item"     EXP_LIST2="$EXP_LIST2 \n $EXP_LIST" done  echo -e $EXP_LIST2

although that added a space to the list, which is fine - I wanted it indented a bit.Also presume the "\n" could be printed in the original $EP_LIST.


Viewing all articles
Browse latest Browse all 9

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>