Read text file using shell script

by Ranganathan 2013-05-20 10:05:15

Example

sh /opt/lampp/htdocs/whois/block.sh 122 155 25 3

where

sh - shell execute command


122 155 25 3 -are argument for block.sh shell script file



Argument read in shell script $1 $2 $3 $4



block.sh




if [ $# == 4 ]; then
FILENAME="dnslist.php" #read text file name
count=0
while read NAME SNAME
do
let count++
tmp=`host $4.$3.$2.$1.$NAME`
tmp="$NAME $SNAME====>$tmp"
echo $tmp
done < $FILENAME
else
echo "enter correct input";
fi
638
like
0
dislike
0
mail
flag

You must LOGIN to add comments