LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris and OpenSolaris.
General Sun, SunOS and Sparc related questions also go here.

Notices

Reply
 
Search this Thread
Old 05-02-2010, 11:54 PM   #1
nagendrar
Member
 
Registered: Apr 2008
Location: HYD, INDIA.
Posts: 141

Rep: Reputation: 15
how to catch function return value in solaris


I pass the return value of fnReturnFunction() to "value" variable as shown below.
It is working fine in linux but not on solaris.

fnReturnFunction()
{
echo $1$2
}
value=$(fnReturnFunction "holly" "wood")
echo $value

In Solaris i am getting following error
Code:
"The following code is used to handle return value of fnReturnFunction with "value" ."
Please help me to solve the problem on Solaris.

ThanQ,
Nagendra
 
Old 05-03-2010, 12:00 AM   #2
nagendrar
Member
 
Registered: Apr 2008
Location: HYD, INDIA.
Posts: 141

Original Poster
Rep: Reputation: 15
Sorry above updating error is wrong .
It gives following error
Code:
syntax error at line 5: `value=$' unexpected
ThanQ,
Nagendra
 
Old 05-03-2010, 12:18 AM   #3
nagendrar
Member
 
Registered: Apr 2008
Location: HYD, INDIA.
Posts: 141

Original Poster
Rep: Reputation: 15
I got it by changing function calling from value=$(fnReturnFunction "holly" "wood") to value=`fnReturnFunction "holly" "wood"`

ThanQ,
Nagendra
 
Old 05-03-2010, 01:51 AM   #4
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,490

Rep: Reputation: 355Reputation: 355Reputation: 355Reputation: 355
Use a decent shell like ksh, bash or /usr/xpg4/bin/sh. /bin/sh is long obsolete.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Get return value of function mortonmorton Linux - Newbie 4 10-09-2009 09:54 PM
How to get return value from C function using shell yhacks Programming 3 03-11-2008 04:58 PM
return from a try catch block manolakis Programming 5 10-24-2007 02:30 PM
How can I get the return value of a function in a shellscript? [KIA]aze Programming 8 07-05-2007 08:18 AM
how to catch the return value of dialog without temp file ? doublehp Linux - Software 1 05-20-2005 10:52 PM


All times are GMT -5. The time now is 01:40 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration