Jump to content
Sign in to follow this  
aaronamd

What Is Wrong With My Script

Recommended Posts

helo again everyone, I have a small script I would like someone to debug for me, there errors in it are probably stupid ones :lol: I havent scripted in a while... well here it is

 

#!/bin/bash

printf "What is the name of your interface?"
read IN
printf "What access point do you want to connect to?"
echo
read AP
printf "What channel do you want to use for $AP"
read CH
echo -n "The encryption code for this access point is: "
read EN
iwconfig $IN essid "$AP"
iwconfig $IN channel $CH
iwconfig $IN encryption $EN
echo
echo "would you like to run dhcp?"
read DH
if [ $DH = "yes" ]; then
       echo "running dhcp"
       dhcpcd $IN
       echo "you should now be connected, have a good session"
       exit 0
else
       echo "what IP would you like to assign to $IN ?"
       read IP
       echo "assighning $IP to $IN "
       echo "what netmask would you like to assighn?"
       read NM
       echo "what is the internet gateway for this network?"
       read GW
       ifconfig $IN $IP $NM
       route add default gw $GW
       echo "you should now be connected, have a good session"
fi

it's a small script for configuring my laptop's wireless card, it seems to get stuck when it hits the if /else statement, it plows through it even if $DH is yes, it will still ask for IP ... and it doesn't fully execute dhcpcd for some weird reason :huh: --FIXED IT NVM , PLEASE DELETE THIS POST k thx by :P

Edited by aaronamd

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×
×
  • Create New...