Need a bit help. I just wrote my first script to change the network configuration. the code is
echo "changing IP to 172.17.51.71" echo "changing Mask to 255.255.255.0" echo "changing Gateway to 172.17.51.254" sed -i 's/.*IPADDR.*$/IPADDR=172.17.51.71/g' /etc/ifcfg-eth0.txt # ne need to change mask sed -i 's/.*IPADDR.*$/IPADDR=172.17.51.71/g' /etc/ifcfg-eth0 sed -i 's/.*GATEWAY.*$/GATEWAY=172.17.51.254/g' /etc/ifcfg-eth0.txt
I copied the
icfg-eth0 file to the
etc folder for testing purpose. When I run the script I get the error
:No such file or diretorytxt :No such file or diretorytxt
But when I just use the commands on the prompt the command works and changes what I want it to change.
Any idea why its not working when running as a script?