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 and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
return value of a function fl0r10 Shell Programming and Scripting 5 07-06-2009 03:37 PM
need to return value from function darshakraut Shell Programming and Scripting 5 05-14-2008 09:13 AM
Function call not return value into var katzs500 UNIX for Advanced & Expert Users 4 04-21-2008 02:27 PM
decimal to binary function error return_user High Level Programming 8 12-21-2007 03:53 PM
return value of a function prez Shell Programming and Scripting 3 08-22-2007 06:08 PM

 
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
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 07-21-2009
mac4rfree mac4rfree is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 170
unable to return a decimal value from a function

Hi Guys,

I am unable to return a decimal value from a function to the main script.
I am getting the correct value in the function but when it is returning to the main script using "return" it is coming as 0. Below is my code.


Code:
read VALUE_V fun_FATHERID fun_SONID fun_TOPID fun_RTYPE < function_output.dat;
echo "outside=$VALUE_V";
echo "outside=$fun_FATHERID";

wc -l function_output.dat | read length dummy;
echo "length=$length";

if [ "$length" -eq "1" ] -a [ "fun_RTYPE" -eq "RW" ]
then
echo "value_v=$VALUE_V";
echo "chile_value=$child_value";
VALUE_V=$(echo "scale=4; $VALUE_V * $child_value" | bc);
echo "inside fucntion=$VALUE_V";
return $VALUE_V;
fi

Thanks for your help in advance.

Regards,
Magesh.

---------- Post updated at 08:22 PM ---------- Previous update was at 08:20 PM ----------

above is the code of the function. the main script just calls this function.
 

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 01:29 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