Author Topic: How to make executable script  (Read 3154 times)

toadatrix

  • Jr. Member
  • **
  • Posts: 72
    • View Profile
    • http://
How to make executable script
« on: March 09, 2004, 09:52:43 pm »
I am a linux newbie.  How do I go about taking a text file containg the following and making this into an executable script:

cd /etc/pcmcia
mv wlan-ng.conf .wlan-ng.conf
mv .hermes.conf hermes.conf
/etc/rc.d/init.d/pcmcia restart

Also, once I have that as an executable script file what directory folder should it be stored in?  Thanks.

boosalis

  • Jr. Member
  • **
  • Posts: 78
    • View Profile
    • http://
How to make executable script
« Reply #1 on: March 09, 2004, 10:12:16 pm »
This might be a good start:
Create a file called myscript.sh with the following:

#!/usr/bin/sh        // or what ever shelll is on Zaurus
then your commands below this
.....


give file executable privledges
chmod 755 myscript.sh

But the problem with your script is that those actions can only be done as root.  You can store it in any directory you want, \"/home/zaurus\" would be a good one. since this is the directory you land in when a terminal window is fired up.

Mabye in the script you could have a \"su\" before your commands, since the root user has not password.

Sorry I can\'t offer more help.  I hate scripts and try to do as little of them as I can.
Zaurus 6000 with expansion jacket

lardman

  • Hero Member
  • *****
  • Posts: 4512
    • View Profile
    • http://people.bath.ac.uk/enpsgp/Zaurus/
How to make executable script
« Reply #2 on: March 10, 2004, 05:24:45 am »
Make sure you don\'t use the Sharp text editor as it will mess up the line feeds (use vi instead :twisted: ) . If you do use this you\'ll need to run dos2unix (from killefiz) on the file to make it usable.


Si
C750 OZ3.5.4 (GPE, 2.6.x kernel)
SL5500 OZ3.5.4 (Opie)
Nokia 770
Serial GPS, WCF-12, Socket Ethernet & BT, Ratoc USB
WinXP, Mandriva

pakman

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
How to make executable script
« Reply #3 on: March 10, 2004, 12:27:55 pm »
Quote
But the problem with your script is that those actions can only be done as root. You can store it in any directory you want, \"/home/zaurus\" would be a good one. since this is the directory you land in when a terminal window is fired up.

Mabye in the script you could have a \"su\" before your commands, since the root user has not password.

A better solution is to use \"sudo\". Go to the downloads section and type it in the search box.

Regards,
P.
Now: Gemini 4G/Android. Previously: Zaurus C760/Cacko lite 1.23