LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Help writing with SH script? (https://www.linuxquestions.org/questions/programming-9/help-writing-with-sh-script-407316/)

SirJinX 01-24-2006 05:50 AM

Help writing with SH script?
 
Hi,

I would like to write an SH script that connects me to the internet automatically.
I am using FC4.

Usually, what I have to do is, in the terminal:

Code:

su - root
<password>
ifconfig wlan0 up
iwconfig wlan0 enc <pass> essid <name>
dhcpcd wlan0

The first problem is that it doesn't enter the password :S


And the 2nd one, would I place it in my /etc/init.d folder for it to start the sciprt every time?

carl0ski 01-24-2006 05:57 AM

Quote:

Originally Posted by SirJinX
Hi,

I would like to write an SH script that connects me to the internet automatically.
I am using FC4.

Usually, what I have to do is, in the terminal:

Code:

su - root
<password>
ifconfig wlan0 up
iwconfig wlan0 enc <pass> essid <name>
dhcpcd wlan0

The first problem is that it doesn't enter the password :S


And the 2nd one, would I place it in my /etc/init.d folder for it to start the sciprt every time?


Code:

!#/bin/bash
ifconfig wlan0 up
iwconfig wlan0 enc <pass> essid <name>
dhcpcd wlan0

save this in a file somewhere
for sake of this

/home/internet.sh.


test it logged in as root or SU
cd /home/;./internet.sh&


if it works
now add it to end of startup file to start at boot.
Code:

echo "cd /home/;./internet.sh&" >>/etc/rc.local


All times are GMT -5. The time now is 11:51 PM.