[x] Welcome to LinuxSolved.com Linux help forums, here we are a community of Linux users helping each other. It is helpful to both ie. new linux users as well experienced one. We always have our experts to help you and ofcourse members help each other, so you can ask for help any time by Registering.: Click to Register

Welcome, Guest. Please login or register.
Did you miss your activation email?


Login with username, password and session length

Linux Forums - Linux Help,Advice & support community:LinuxSolved.com  |  Forum  |  Linux in General  |  Linux Development & Programming  |  Topic: Running shell Script
The LinuxSolved.com GNU/Linux User Communit - Forum
Welcome to LinuxCommunity You have just arrived to a friendly linux community which is helping Linux Users from Years.. You can be its part if you have not already joined it. Registration is FREE and is gateway to unlimited help and support to all your linux related needs. If you are an GNU/Linux supporter then you have come to the right place.
Pages: [1]
  Print  
Author Topic: Running shell Script  (Read 948 times)
0 Members and 1 Guest are viewing this topic.
shipoin_97
Tux Awared
**
Offline Offline

Posts: 42


View Profile
« on: December 10, 2005, 01:29:56 AM »

DeAr ,

        I am a newbie runnig shell scripting in Linux .  I have the following questions like ,

        1) If i wrte a  script  like
     
                #!/bin/bash
               #make_page - A Script to produce an HTML file
                                                                               
              title="System Information for"
            cat <<- _E OF_
<HTML>
<HEAD>
     <TITLE>
         $title $shipon
     </TITLE>
</HEAD>
                                                                               
 <BODY>
    <H1>$title $shipon</H1>
</BODY>
 </HTML>
                                                                               
_EOF_
                                                                               
            How can i run it ? or using which cammand i  show my system information .


2 ) if  i  write the following script

              function system_info
{
    echo "<h2>System release info</h2>"
    echo "<p>Function not yet implemented</p>"
}

 How i can run it ?

                          Plz help me ........
Logged
dragoncity99
LST CareTaker
Experienced
*****
Offline Offline

Posts: 494


View Profile
« Reply #1 on: December 14, 2005, 08:56:18 AM »

If u wan to run the script u have to change ur script to executable file first.

# chmod +x your-script.sh

To run it:
# ./your-script.sh

To run a function:
1. Your function must be at the top most of the script after #!/bin/bash or #!/bin/sh
2. To initiate/call the function just type name of the function:

Code:

#!/bin/sh
myfunction(){
  echo "HelloWorld"
}

# Just call the function name
myfunction


Got it?
Logged
Linux Forums - Linux Help,Advice & support community:LinuxSolved.com
   

 Logged
Pages: [1]
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
BASH SHELL SCRIPT Linux Development & Programming nicksthegreat 1 1321 Last post April 08, 2004, 06:02:04 AM
by sudipta_cht
shell script Linux Development & Programming puneetloiya 3 1442 Last post May 10, 2004, 11:59:35 AM
by dragoncity99
run shell script immediatly u do # rpm -ivh Linux Development & Programming ganeshgore81 2 1055 Last post September 18, 2007, 07:01:41 AM
by gauravbajaj
shell script and binary together Linux Development & Programming ganeshgore81 1 866 Last post January 23, 2006, 12:03:42 PM
by dragoncity99
Shell Script Miscellaneous gauravbajaj 6 863 Last post May 08, 2006, 05:34:32 AM
by gauravbajaj
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 22, 2008, 10:58:22 AM

Login with username, password and session length
Navigation
Recent Discussions
[November 20, 2008, 11:30:52 PM]

[November 19, 2008, 07:52:41 PM]

[November 19, 2008, 07:52:36 PM]

[November 17, 2008, 10:42:59 AM]

[November 16, 2008, 12:49:47 AM]

[November 16, 2008, 12:48:58 AM]

[November 15, 2008, 08:29:02 AM]

[November 15, 2008, 08:24:41 AM]

[November 14, 2008, 05:11:50 AM]

[November 13, 2008, 03:28:22 AM]
Members
Total Members: 6227
Latest: karunadct
Stats
Total Posts: 8269
Total Topics: 2253
Online Today: 10
Online Ever: 111
(June 28, 2007, 06:47:29 AM)
Users Online
Users: 0
Guests: 8
Total: 8
Privacy Policy| Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks
Theme & TinyPortal v0.9.8 © Bloc