The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
passing a variable inside a variable to a function KingVikram UNIX for Dummies Questions & Answers 2 01-14-2008 04:28 PM
Passing a unix variable value to a Plsql function cobroraj UNIX for Advanced & Expert Users 1 10-30-2007 02:59 AM
passing variable to function Knotty UNIX for Dummies Questions & Answers 4 04-04-2007 09:49 PM
How to get exit value of an executable that gets called from function? sureshreddi_ps High Level Programming 1 09-09-2004 07:57 AM
Passing a variable name to be created within a function 435 Gavea Shell Programming and Scripting 2 02-04-2004 11:20 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-18-2007
Registered User
 

Join Date: Oct 2006
Posts: 19
Stumble this Post!
Passing global variable to a function which is called by another function

Hi ,

I have three funcions f1, f2 and f3 .
f1 calls f2 and f2 calls f3 .
I have a global variable "period" which i want to pass to f3 .
Can i pass the variable directly in the definition of f3 ?
Pls help .

sars
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 02-18-2007
Registered User
 

Join Date: Mar 2006
Location: Bangalore,India
Posts: 1,397
Stumble this Post!
You can access the global variable directly in the function.
Code:
period="hi"
f3()
{
echo $period
}
f3
Reply With Quote
  #3 (permalink)  
Old 02-18-2007
Registered User
 

Join Date: Oct 2006
Posts: 19
Stumble this Post!
Resolved

Ya ,
i was able to pass the global variable to the function .
Sorry for that dumb question .
Reply With Quote
  #4 (permalink)  
Old 06-30-2008
Registered User
 

Join Date: Jun 2008
Posts: 3
Stumble this Post!
how do i get a result in fraction in shell script.

I am using expr for division of two numbers but it is giving Quotient.

I need it in full fraction value.
Reply With Quote
  #5 (permalink)  
Old 06-30-2008
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,002
Stumble this Post!
Quote:
Originally Posted by alby View Post
how do i get a result in fraction in shell script.

I am using expr for division of two numbers but it is giving Quotient.

I need it in full fraction value.
Pls don't 'piggy-back' threads - start a new thread.
Also please read the Rules.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 11:50 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0