LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-15-2008, 11:43 AM   #1
knockout_artist
Member
 
Registered: Sep 2005
Distribution: fedora core 9
Posts: 324

Rep: Reputation: 33
calling function shell script very simple ones


Good Day,

Is there any thing wrong with way I am trying to print "three".
Is this not the wright way to call function?

Code:
#!/bin/sh

echo one
 
  sleep 2

echo two
  
  sleep 2 

$difer

  difer ()
      {
      echo three
      }
Thanks.
 
Old 05-15-2008, 11:58 AM   #2
drauk
Member
 
Registered: Sep 2007
Location: /MX/BC/TJ
Distribution: Slackware 13
Posts: 37

Rep: Reputation: 15
the function have to be defined before the call, also the you don't need $ to call the funcion:
Code:
#!/bin/sh

echo one
 
  sleep 2

echo two
  
  sleep 2 

  difer ()
      {
      echo three
      }

difer
 
Old 05-15-2008, 12:01 PM   #3
knockout_artist
Member
 
Registered: Sep 2005
Distribution: fedora core 9
Posts: 324

Original Poster
Rep: Reputation: 33
Thank you very much!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
can a C function return value to Shell Script variable yarnar Programming 17 06-02-2010 05:54 PM
Need help getting started simple simple shell script dhonnoll78 Programming 6 12-17-2007 05:34 PM
arithmethic function inside shell script mystical dervish Linux - Newbie 3 08-21-2007 04:57 AM
Shell script help with function and output format altrob Programming 4 09-27-2006 02:51 PM
Directory listing - Calling shell script from a CGI script seran Programming 6 08-11-2005 11:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:44 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration