How to display an array's content in colomns, like ls -C does.

Posted by Arko on Stack Overflow See other posts from Stack Overflow or by Arko
Published on 2010-06-10T13:41:09Z Indexed on 2010/06/11 4:32 UTC
Read the original article Hit count: 263

Filed under:
|
|
|
|

I wanted to display a long list of strings from an array.

Right now, my script run through a for loop echoing each value to the standard output:

for value in ${values[@]}
do
  echo $value
done

Yeah, that's pretty ugly! And the one column listing is pretty long too...

I was wondering if i can find a command or builtin helping me to display all those values in columns, like the ls command does by default when listing a directory (ls -C).

© Stack Overflow or respective owner

Related posts about arrays

Related posts about bash