I am trying to replace a value of a variable in a script with sed but the result so far is that the changed variable is written to stdout, instead of to the script.What am I doing wrong?This is my script: #!/bin/bash # si es la primera vez, hacemos una copia de nuestro /etc/hosts ls /etc/hosts.old &> /dev/null if [ $? -ne 0 ]; then cp /etc/hosts /etc/hosts.old fi # comprobamos con curl si el documento se modifico en el servidor OLD=Nov NEW=`curl -sI http://winhelp2002.mvps.org/hosts.txt| grep Last-Modified|awk '{print $4}'` if [ $OLD != $NEW ]; then #wget http://winhelp2002.mvps.org/hosts.txt -O /root/hosts.txt #cat /root/hosts.txt|uniq >> /etc/hosts # actualizamos la variable OLD si cambi sed -n /OLD=/ cOLD=${NEW} /root/addblock.sh else echo  el archivo no se modifico fi exitand this is the output:# ./addblock.sh# OLD=Dec#
Using sed to replace a variable
sed