linux command wc

Linux command wc

Purpose

       Learning how to statistics line numbers in file

 

Eevironment

       Ubuntu 16.04 terminal

 

Procdeure

      

$ cat test.sh 
#!/bin/bash

echo "shell args option"
echo "script name : $0"
echo "first args : $1"
echo "first args : $2"
echo "first args : $3"

echo "------- \$# demonstration"
echo "args number: $#"


echo "------- \$\$ demonstration"
echo "shell pid: $$"

echo "------- \$* demonstration"
for i in "$*";do
echo $i
done

echo "------- \$@ demonstration"
for i in "$@";do
echo $i
done

echo "------- \$- demonstration"
echo $-

$ cat test.sh | wc -l
27

it can be use for  statistics  line numbers

posted @ 2019-01-24 13:52  嵌入式实操  阅读(241)  评论(0编辑  收藏  举报