I like to do the following if running in a script where the function is defined:

POINTER= # used for function return values

my_function() {
    # do stuff
    POINTER="my_function_return"
}

my_other_function() {
    # do stuff
    POINTER="my_other_function_return"
}

my_function
RESULT="$POINTER"

my_other_function
RESULT="$POINTER"


I like this, becase I can then include echo statements in my functions if I want

my_function() {
    echo "-&gt; my_function()"
    # do stuff
    POINTER="my_function_return"
    echo "&lt;- my_function. $POINTER"
}


Return value in bash script
I know sugars have $\ce{-OH}$ groups, and that sulfuric acid is a strong acid. What I'm failing to see is how exactly sulfuric acid dehydrates sugars. Does it protonate the hydroxyl groups, making them good leaving groups? What about the case of sucrose? 



For example, how are the oxygens "taken care of" by the sulfuric acid? Are they doubly protonated? Is there some established mechanism for the dehydration of sugars by sulfuric acid, because I can't find any - I just find general equations and I've looked on Google and through textbooks. 

After some further research I learned that the gas, sulfur dioxide, is evolved. This suggests to me that this reaction is also redox in nature. So is this reaction both an acid-base reaction and a redox reaction? Sulfur in sulfuric acid has an oxidation state of +6; sulfur in sulfur dioxide has an oxidation state of +4. Plus the elemental carbon formed has an oxidation state of 0 while in sucrose, carbon has various oxidation states. 
