Program:
if [ $# -eq 1 ]
then
terminal=`tty1`
exec<$1
flag=1
fi
nol=0
now=0
echo "input any data"
while read line
do
nol=`expr $nol + 1`
for words in $line
do
now=`expr $now + 1 `
done
done
echo "no of lines=$nol"
echo "no of words=$now"
if [ " $flag " -eq 1 ]
then
exec << $terminated
fi
Input/OutPut
input any data
The Pedanandipadu College of Arts and Sciences
Pedanandipadu
Guntur-Dt
AP
no of lines=4
no of words=10
No comments:
Post a Comment