Beranda » Pemrograman » Configurasi Network dengan Program Bourne Shell (Bash)

Configurasi Network dengan Program Bourne Shell (Bash)

Start here

#!/usr/bin/sh
#./testing
# ini hanya program sederhana buaget
# boleh dikatakan di bawah standart

ikbal='y'
while [ $dady = 'y' ] || [ $dady = 'Y' ];
do
clear
   tput cup 2 20
    echo -e "33[5m33[44m testing... 33[0m";
     tput cup 3 10

      echo "     1. Aktifkan interface      ";
       tput cup 4 10
      echo "     2. Nonaktifkan interface  ";
         tput cup 5 10
      echo "     3. Setting ip statik      ";
           tput cup 6 10
      echo "     4. Remove ip              ";
             tput cup 7 10
      echo "     5. Exit                   ";
           tput cup 8 20
           read -p "your choice : " pil;
          if [ $pil -eq 1 ];
         then
        tput cup 9 20
       read -p "interface : " iface;
      ifconfig $iface up
     elif [ $pil -eq 2 ];
    then
   tput cup 10 20
  read -p "interface : " sib;
 ifconfig $sib down
elif [ $pil -eq 3 ];
 then
  tput cup 10 20
   read -p "input ip : " ip;
    tput cup 11 20
     read -p "interface : " tes;
      tput cup 12 20
       read -p "input gateway : " gat;
        ip a a $ip/24 brd + dev $tes
         ip route add default via $gat
          elif [ $pil -eq 4 ];
           then
            tput cup 9 20
             read -p "interface : " re;
              ip a f $re
               elif [ $pil -eq 5 ];
                then
                 tput cup 10 20
                  echo -e "33[5m33[44m LOADING... 33[0m";
                   exit 0
                    else
                     tput cup 11 20
                      echo -e "33[5m33[44m sorry choice are not available 33[0m";
                       exit 1
                      fi
                     tput cup 15 20
                    echo -n "back to choice number (y/t) : ";
                   read ikbal;
                  while [ $dady != 'y' ] && [ $dady != 'Y' ] && [ $dad y!= 't' ] && [ $dady != 'T' ];
                 do
                tput cup 13 20
               echo "sorry you had to choose (y/Y/t/T)";
              tput cup 14 20
             echo -n "sorry you had to choose (y/t)";
            read dady;
           done
          done


Tinggalkan Balasan

Please log in using one of these methods to post your comment:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s