howto pass argument with a script to execute a command
I have a bash script, name script.sh with below data. I want to ran script.sh start which only triggers(ip route add 10.10.20.1 via 192.168.24.1 dev eth0 src 192.168.24.100) and if I run script.sh stop which only triggers (ip route del 10.10.20.1 via 192.168.24.1 dev eth0 src 192.168.24.100). When I run the below script, it executes but the ip route command cant run. please advice, I am not much good in code.
#!/bin/bash
start ()
{
ip route add 10.10.20.1 via 192.168.24.1 dev eth0 src 192.168.24.100
}
stop ()
{
ip route del 10.10.20.1 via 192.168.24.1 dev eth0 src 192.168.24.100
}
|