0

我需要在 cat/column 环境中的一行中打印文件列表。问题是——它打印成多行:

#!/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
4

1 回答 1

2

您可以在没有以下情况下达到相同的效果cat

echo $Files | column -s\& -t

这不会给出问题cat


对于链接中给出的输入:

    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")

会工作。

于 2012-12-19T18:03:34.733 回答