I am brand-spankin' new to Bash script from a web programming background, so my questions are going to, perhaps, sound "ignert" at best, but understand, I come from a TCL/PHP/Java/ASP background so I'm accustomed to All Things Web
Having said that, I need help. I wrote a bash script function that will return a string (or whatever bash comes closest to doing "return" as) and needs to return it into a variable that I will use later.
Here is the function:
Problem is that I have no clue as to how to capture the return of this function.
does not work also does not work also does not work also does not work [CODE excludedList=`echo \\`tarExcludedList\\''[/CODE].. you guessed it.
What do I do? I want to return the last line of tarExcludedList into a variable and have no clue how.
Joined: Jul 13, 2004
BTW I figured out I was using the wrong function name, nonetheless, nothing still works, I cannot output the function results no matter what I try.
I know in TCL it's this
In PHP it's this
and in Java it would be a string return that I just do
Perhaps what I don't understand is the fact that bash script seems to have no concept of scope that I can fathom. Assigning a global variable failed upon doing so.
What I wound up doing was throwing out a weird code snippet that worked:
Where $excludedList was a variable set in the function that, for some wacko reason, becomes instantly global. This is nowhere near what I'm used to in any programming language so I never would have guessed that one.