Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Thanks for help me . Now share my shell script .
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
Crazy_Jerry
n00b
n00b


Joined: 08 May 2012
Posts: 44

PostPosted: Mon Dec 24, 2012 3:39 pm    Post subject: Thanks for help me . Now share my shell script . Reply with quote

I am a new guy
Before few days , I asked a question here
Code:
http://forums.gentoo.org/viewtopic-t-945484.html

Now I did not solved the problem,but I still want to say Thank you for everyone .
Here is my shell script, maybe it could be help someone . Just a simple script .
Thanks again .


In the /etc/local.d/network.start
Code:


#!/bin/bash

/home/root/.network.sh

        if [ $? -ne 0 ]
        then
                dhcpcd -x
                logger " Not found wireless network !! "
        else
                logger " Wireless and dhcpcd done ."

        fi


In the /home/root/.network.sh
Code:

#!/bin/bash
#WNAME backup command:
#       grep ssid /etc/wpa_supplicant/wpa_supplicant | awk -F '"' '{print $2}' 

WPATH=/etc/wpa_supplicant/wpa_supplicant
WNAME=`grep ssid  $WPATH | awk -F "=" '{print $2}' | sed -n 's/\(.\)\(.*\)\(.\)/\2/gp' > /tmp/nettrash`
WNUMBER=`grep ssid  $WPATH | awk -F "=" '{print $2}' | sed -n 's/\(.\)\(.*\)\(.\)/\2/gp' | wc -l`

for  ((i=0;i<$WNUMBER;i++))

do

        iwlist wlan0 scan | grep -i essid | grep  `head -1 /tmp/nettrash`

        if [ $? -eq 0 ]

        then

        wpa_supplicant -iwlan0 -B -c $WPATH

        break
       
        else
                echo "ERROR !!  Try next !!"
               
        fi


                sed -i '1 d' /tmp/nettrash


done


_________________
God be with us !


Last edited by Crazy_Jerry on Mon Dec 24, 2012 5:07 pm; edited 1 time in total
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54578
Location: 56N 3W

PostPosted: Mon Dec 24, 2012 4:28 pm    Post subject: Reply with quote

Moved from Portage & Programming to Documentation, Tips & Tricks.
Its one or more of the above, so belongs here.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum