im new to shell scripting

i want a simle script to configure the ip adress and add a default gw

this is what i got so far

#!/bin/bash
    ifconfig eth0 "ipadress" 
    route add default gw "gw adress"

it does not recognise route ? can anyone help?

What shows when you type

route -n

after running your script?

I have used the following before

#!/bin/bash

$IP="192.168.1.12"
$ROUTE="192.168.1.1"

ifconfig eth0 inet $IP netmask 255.255.255.0
route add default gw $ROUTE

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.