On 05 Aug 17:49, Mark Rogers wrote:
On 05/08/10 17:33, Mark Rogers wrote:
OK, I've been saving this until I have time to try this, but I'm a bit out of my depth...
Nothing like a bit of trial and error....
This seems to work as a script (well it did when I remembered to chmod +x it!)
#!/bin/sh set -e if [ "$IFACE" = eth0 ] ; then sudo ifconfig $IFACE add 192.168.20.117 netmask 255.255.255.0 fi
That looks OK to me, though, I would have used the ip command instead, and I wouldn't have bothered with the sudo (those scripts are run as root).
So, my version of the script would have been:
#!/bin/sh
set -e
if [ "$IFACE" = "eth0" ]; then ip addr add 192.168.20.117/24 dev $IFACE fi
But otherwise, all good.
Cheers,