有没有办法得到wc在bash中返回的整数?
基本上,我想在文件名之后将行号和字数写入屏幕。
output: filename linecount wordcount
这是我到目前为止的内容:
files=`ls`
for f in $files;
do
if [ ! -d $f ] #only print out information about files !directories
then
# some way of getting the wc integers into shell variables and then printing them
echo "$f $lines $ words"
fi
done