Results 1 to 2 of 2
...how do I do it. I've read every tutorial i could find and all I found was some back asswards way of to 'pass-by-reference' and changing the actual variable sent ...
- 04-02-2007 #1Just Joined!
- Join Date
- Mar 2007
- Posts
- 15
Bash - Returning String From Functions
...how do I do it. I've read every tutorial i could find and all I found was some back asswards way of to 'pass-by-reference' and changing the actual variable sent to the function.
Basically all I want to do is this, except using bash scripting
Code:using namespace std; //just for you code nazi's - you know who you are string createSomeText() { string x = "Foo Bar" return x; } int main() { string text = createSomeText(); return 0; }
- 04-02-2007 #2Linux Engineer
- Join Date
- Apr 2006
- Location
- Saint Paul, MN, USA / CentOS, Debian, Solaris, SuSE
- Posts
- 1,117
Hi.
Yes, you need to get 2 features together, the first is the function itself, which you apparently know about.
The other feature is:
The Advanced Bash-Scripting Guide, noted above, is a good document to look over -- it's long, but well-worth your time ... cheers, drlFor purposes of command substitution, a command may be an external system command, an internal scripting builtin, or even a script function.
-- the description of which you can find at: http://www.tldp.org/LDP/abs/html/commandsub.htmlWelcome - get the most out of the forum by reading forum basics and guidelines: click here.
90% of questions can be answered by using man pages, Quick Search, Advanced Search, Google search, Wikipedia.
We look forward to helping you with the challenge of the other 10%.
( Mn, 2.6.n, AMD-64 3000+, ASUS A8V Deluxe, 1 GB, SATA + IDE, Matrox G400 AGP )


Reply With Quote