0

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
Adobe
  • 12,967
  • 10
  • 85
  • 126

1 Answers1

2

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.

P.P
  • 117,907
  • 20
  • 175
  • 238
  • But it is a part of a complex help message like [this one](https://github.com/bk322/bk_automates/blob/master/bk_seds_files/bk_seds_files.bash). The code in the link -- has the same problem -- it lists files in the `-s` option (currently it is line 42). – Adobe Dec 19 '12 at 20:13
  • @Adobe The idea is just to echo everything and pass it to column. – P.P Dec 19 '12 at 20:23
  • You might have line breaks because the same prints like this: http://pastebin.com/9PJMg9iD – P.P Dec 19 '12 at 21:01