![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| function return array | dophine | Shell Programming and Scripting | 6 | 05-06-2008 09:16 AM |
| Function call not return value into var | katzs500 | UNIX for Advanced & Expert Users | 4 | 04-21-2008 10:27 AM |
| Function call not return value into var | katzs500 | UNIX for Dummies Questions & Answers | 1 | 04-18-2008 06:31 PM |
| ORACLE return a function to Solaris | Rafael.Buria | Shell Programming and Scripting | 1 | 10-23-2007 02:38 PM |
| return value of a function | prez | Shell Programming and Scripting | 3 | 08-22-2007 02:08 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
how to return value from function and print from main program???
And also I need to return true or false... Is it possible? |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Sure you can do both, just like from any shell script. Output is output and exit / return status is a different thing.
Code:
myfunc () {
echo Fnord
return 42
}
|
|
#3
|
||||
|
||||
|
It's certainly possible, which is the language in use ?
|
|
#4
|
|||
|
|||
|
I m working in Perl.
|
|
#5
|
|||
|
|||
|
and also want to print the returned value.
|
|
#6
|
||||
|
||||
|
If it's used in sub routine, use "return" function, otherwise printing the last value can be done with 'print "$variable_name\n"'
Also, you can always define custom return codes and strings, and print them when matching certain conditions. |
||||
| Google The UNIX and Linux Forums |