Linux Forums - Linux Help,Advice & support community:LinuxSolved.com

Linux in General => Linux Development & Programming => Topic started by: puneetloiya on May 10, 2004, 09:51:06 AM

Title: shell script
Post by: puneetloiya 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
Title: shell script
Post by: dragoncity99 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
Title: I didnt get
Post by: puneetloiya 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
Title: shell script
Post by: dragoncity99 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