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

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

$
0
0

Using for:

for each in "${alpha[@]}"do  echo "$each"done

Using history; note this will fail if your values contain !:

history -p "${alpha[@]}"

Using basename; note this will fail if your values contain /:

basename -a "${alpha[@]}"

Using shuf; note that results might not come out in order:

shuf -e "${alpha[@]}"

Viewing all articles
Browse latest Browse all 9

Trending Articles



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