I am programming a script and using while read
twice it does 1 only once:
un=$(echo $LOGNAME | tr '[A-Z]' '[a-z]')
grep -v '^#' nodeteste.txt > auxiliar.txt
while read line
do
ssh "$un@$line" "cat arquivo" > arquivo.externo
cut -d "," -f 1 arquivo.externo > arquivo.externo.cut
uniq arquivo.externo.cut > arquivo.externo.cut.uniq
while read line2
do
valor=$(grep -c "$line2 " arquivo.base)
if [ $valor -eq 0 ]; then
echo $line >> arquivo.base.diferente
echo $line2 >> arquivo.base.diferente
grep -i "$line2," arquivo.externo >> arquivo.base.diferente
echo $line $line2 $valor "eh diferente"
fi
done < arquivo.externo.cut.uniq
done < auxiliar.txt
rm auxiliar.txt
It runs the first while
only once, I'm suspicious that it has lost stdin / out at some point !! Someone could give some tips !!