bash script help
hi all,
i have a problem with this script, the variable MacAdd isn't usable outside the internal while !
Please help me
Thanks
#!/usr/bin/bash
cat source.txt | while read LineS; do
tokenS=`echo $LineS |awk '{ print $1 }'`
MacAdd=""
cat FileDb.txt | while read LineDb; do
tokenDb=`echo $LineDb |awk '{ print $1 }'`
# echo $tokenS " " $tokenDb
if [ "$tokenS" != "$tokenDb" ]
then
MacAdd=$tokenS
# echo "not equal"
else
MacAdd=""
# echo "string equal"
fi
done
if [ "$MacAdd" == "" ]
then
echo "string empty"
else
echo "mac address " $MacAdd
fi
done
|