Problem in a loop by while in a bash script
Hi,
I've written the below code to read some IP from an input file ,...
but after running, The "while code" part just run one time!!!
DD=$(date --date="yesterday" +%a" "%b" "%d)
echo $DD
while read LINE
do
IP=$LINE
rm -f rbtdate.txt
rm -f rbt2.txt
echo "------------------------- " $IP " ------------------------"
sshpass -p "123" ssh -p 22 root@$IP 'last reboot|head -30'>rbt2.txt
cut -c 40-50 rbt2.txt>rbtdate.txt
awk '$1=gensub(" "," ",$1) ~ '/"$DD"/' {++c} END {print c}' FS=: rbtdate.txt
done < IP10
Last edited by massy; 01-05-2014 at 12:59 AM.
|