Reputation: 13467
I need to print a list of files in one line in cat/column environment. The problem is -- it prints in multiple lines:
#!/bin/bash
Files=`ls ~/`
echo $Files # prints in one line as I want. But I have to do it inside cat/column:
# prints files in column -- despite column separator is &:
cat << EO | column -s\& -t
$Files
EO
Upvotes: 0
Views: 798
Reputation: 121357
You can achieve the same effect without cat
:
echo $Files | column -s\& -t
This won't give the problem that cat
does.
For that input have given in the link:
column -s\& -t <(echo " -a, --all & apply the sed script to files in current dir and subdirs
-d, --dirs & apply the sed script to first-level-dir names
-f, --file & apply the sed script to a given file. It is a single command, but the script keep You from getting into manuals
-h, --help & show this output
-s, --script & the sed script to be used (currently: `ls $(dirname $0)/scripts`)
-v, --version & show version information
-I, --noi & overwrite existing files")
would work.
Upvotes: 2