1

can someone take a look over this script? I want to add it in a sh file. When I connect my ethernet adapter I don't want enter all commands again. I just want to execute it from shell. Is this correct?

#!/bin/sh
ip link set eth0 up
sleep 1;
ip addr add 192.168.178.50/24 dev eth0
sleep 1;
ip route add default via 192.168.178.1 dev eth0
sleep 1;
ndc network create 1
sleep 1;
ndc network interface add 1 eth0
sleep 1;
ndc resolver setnetdns 1 8.8.8.8 8.8.4.4
sleep 1;
ndc network default set 1

When I enter the commands directly into terminal emulator ir works, when I execute the script with #sh filename.sh I get error.

The second problem is, my file in root folder isn't here anymore after reboot.

Irfan Latif
  • 20,353
  • 3
  • 70
  • 213
user314662
  • 21
  • 3

0 Answers0