November 24, 2024, 03:18:35 AM

News : LinuxSolved.com Linux Help Community Forum..


Author Topic: shell script  (Read 11367 times)

Offline puneetloiya

  • Linux Noob !
  • *
  • Posts: 28
shell script
« on: May 10, 2004, 09:51:06 AM »
hi all,

        as i m very new to Linux . plz tell me how to run shell script in Linux

bye

Puneet

Offline dragoncity99

  • LST CareTaker
  • Experienced
  • *****
  • Posts: 551
shell script
« Reply #1 on: May 10, 2004, 10:04:32 AM »
To run it, simply type

"./"" and followed by the script name without spaces after "/"
Make sure u r in that scripts directory too.

i.e. For a script called "myScript" which is located in /home/richard directory, type:
----> cd /home/richard

----> ./myScript


OR u can do so by typing the command :

----> /home/richard/myScript

Offline puneetloiya

  • Linux Noob !
  • *
  • Posts: 28
I didnt get
« Reply #2 on: May 10, 2004, 11:50:56 AM »
Hello Dragoncity,

               i didn't get u . plz tell me in details vth one example.

thnx

Puneet

Offline dragoncity99

  • LST CareTaker
  • Experienced
  • *****
  • Posts: 551
shell script
« Reply #3 on: May 10, 2004, 03:59:35 PM »
1. Create a  new script called "abc" in /home directory and type the following text:

/sbin/ifconfig


2. Save and exit.

3. Now open go to the current home directory using a terminal/console ----> text mode, go to the home directory.


4. Type:
   
                chmod 770 abc

5. now "abc" will be an executable script which will display the ip address of ur network card let's say eth0.


6. run the script u have just created by typing:

./abc


Done