行数を取得して、次のようなステートメントでエコーする必要があります。
echo "number of lines is: (lines go here)
数値を取得するために使用cat names | wc -l
していますが、それを変数に取得したり、エコーしたりすることはできません。
これはどう:
myLineCount=$( /bin/wc -l < $fileName)
echo "number of lines is: $myLineCount"
または、変数をスキップして、次のように echo ステートメントに直接埋め込むこともできます。
echo "number of lines is: $( /bin/wc -l < $fileName)"
IHTH
猫はいらない:
echo "number of lines is: $(wc -l names | awk '{print $1}')"
LNUM=`wc -l names | awk '{print $1}'`
echo "number of lines is: $LNUM"