i assume the functions are running in a subshell depending on how you ionvoke them.
The subshell is closed after execution an the variables are lost. export does only work from parent to child.
I have a function that extracts data from a database, which another function reads. This stores a starting sequence number.
Then the script performs various actions.
Then at the end another function needs to get the starting sequence number to process some files.
Here are the functions and how they are called. The first two pipelined are the ones extracting/reading the data from within the database, then the bottom one needs to get the value read by setStopSeq
You shouldn't have to use export to make variables within a function become global. Once a function is run, it's variables should be available throughout the rest of your script.
If you are invoking a subshell (while statement?) in one of your functions, that's another story. It would help to see the other functions to debug this problem.
Are you certain that the values from Function 1 are being passed to Function 2 when using the pipe? If you want to pass a variable to your second function, I'd do it like this: