echo BASH Variables sobreescribiendo problema de texto
OS X 10.6.5, BASH
Cuando ejecuto esto:
echo $IP; echo of; echo $IPLINES
Me sale esta salida:
219.80.4.150:3128
of
1108
Cuando ejecuto esto:
echo $IP of $IPLINES
Me sale esta salida:
of 1108.150:3128
Esperaba obtener:
219.80.4.150:3128 of 1108
¿Qué causaría la salida distorsionada que estoy recibiendo?
El guión real es este:
#!/bin/bash
IPLINES=`cat a.txt | wc -l | awk '{print $1}'`
if [ $IPLINES > 1 ]; then
LINE=`expr $RANDOM % $IPLINES + 1`
IP=`head -$LINE a.txt | tail -1`
sed -e "${LINE}d" -i .b a.txt
echo $IP of $IPLINES
fi