I have a bash script
foo that provides me with many short lines of output. Think
ls -1. To get a more compact presentation, I would like to distribute the output over multiple columns, like
I know that constructions like
foo | paste - - - | column -t -s $'\t'
will give me a fixed number of columns, in this case three. How can I dynamically adjust the number of columns to output width and terminal width such that I always use the maximal number of columns?
COLUMNSvariable? would something as simple as
foo | column -c $COLUMNSwork in this case?