The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 and shell scripting languages 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 08:28 PM
Passing a unix variable value to a Plsql function cobroraj UNIX for Advanced & Expert Users 1 10-30-2007 06:59 AM
passing variable to function Knotty UNIX for Dummies Questions & Answers 4 04-05-2007 12:49 AM
How to get exit value of an executable that gets called from function? sureshreddi_ps High Level Programming 1 09-09-2004 10:57 AM
Passing a variable name to be created within a function 435 Gavea Shell Programming and Scripting 2 02-04-2004 03:20 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-19-2007
sars sars is offline
Registered User
  
 

Join Date: Oct 2006
Posts: 19
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
  #2 (permalink)  
Old 02-19-2007
anbu23 anbu23 is offline Forum Advisor  
Registered User
  
 

Join Date: Mar 2006
Location: Bangalore,India
Posts: 1,398
You can access the global variable directly in the function.
Code:
period="hi"
f3()
{
echo $period
}
f3
  #3 (permalink)  
Old 02-19-2007
sars sars is offline
Registered User
  
 

Join Date: Oct 2006
Posts: 19
Resolved

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

Join Date: Jun 2008
Posts: 3
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.
  #5 (permalink)  
Old 06-30-2008
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,119
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.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:07 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0