plecebo.mc
August 6th, 2012, 12:56 PM
Hi guys I have been writing an autologin script for some friends at college so we can logon i finished the main program but now im working on adding some neat features to it. One of which is a preliminary check of the computers network connection and reliability.
Idea: The idea is to add a new section of code to my main script
the script will:
1) check to see that the network ssid matches one of the ones provided by the W# variables and also if 6 or more of 10 packs sent with ping are returned.
2) in the event that the first step fails the script will run a loop until the first step is true
3) when its done it will continue on with the rest of the script (not provided as this is a test script of these functions)
system: this code is written in bash and is used on osx (note: networkset and airport commands) even so it should not be an issue for you guys to check the script.
Problem: after countless trial and error and google and man pages i got every thing so far to work (as far as i know its correct) but the problem is the script seems to want to skip the whole entire ChangeNetwork function. Maybe im using the wrong syntax in my conditional's or maybe its something else either way i tried alot and now im having to resort to some outside help.
___
This is the script:
http://pastebin.com/FCuQ6u6K
____
This is my output:
bash -x test.sh
++ ping -c10 www.google.com
++ grep received
++ awk -F, '{ print $2}'
++ awk '{ print $1}'
+ ping=10
++ airport -I
++ grep -w SSID:
++ awk -F, '{ print $1}'
++ awk '{ print $2}'
+ ssid=Motorola
+ declare -ir FALSE=1
+ declare -ir TRUE=0
+ W1=AUStudentOpen
+ W2=AURESNET
+ W3=AUGuest
+ echo 'Initiating preliminary checks NOW!'
Initiating preliminary checks NOW!
+ '[' CheckOnline == 1 ']'
((ends after that))
Thanks everyone I'm looking forward to some helpful insight.
Idea: The idea is to add a new section of code to my main script
the script will:
1) check to see that the network ssid matches one of the ones provided by the W# variables and also if 6 or more of 10 packs sent with ping are returned.
2) in the event that the first step fails the script will run a loop until the first step is true
3) when its done it will continue on with the rest of the script (not provided as this is a test script of these functions)
system: this code is written in bash and is used on osx (note: networkset and airport commands) even so it should not be an issue for you guys to check the script.
Problem: after countless trial and error and google and man pages i got every thing so far to work (as far as i know its correct) but the problem is the script seems to want to skip the whole entire ChangeNetwork function. Maybe im using the wrong syntax in my conditional's or maybe its something else either way i tried alot and now im having to resort to some outside help.
___
This is the script:
http://pastebin.com/FCuQ6u6K
____
This is my output:
bash -x test.sh
++ ping -c10 www.google.com
++ grep received
++ awk -F, '{ print $2}'
++ awk '{ print $1}'
+ ping=10
++ airport -I
++ grep -w SSID:
++ awk -F, '{ print $1}'
++ awk '{ print $2}'
+ ssid=Motorola
+ declare -ir FALSE=1
+ declare -ir TRUE=0
+ W1=AUStudentOpen
+ W2=AURESNET
+ W3=AUGuest
+ echo 'Initiating preliminary checks NOW!'
Initiating preliminary checks NOW!
+ '[' CheckOnline == 1 ']'
((ends after that))
Thanks everyone I'm looking forward to some helpful insight.