I have a function that returns a value.
But I would like to add some echos for easier debugging. But this scrabbles the result.
Example:
function foo {
echo "In foo"
VAR="1234"
echo "Calculated item"
echo "$VAR"
}
RESULT=$(foo)
echo "RESULT=$RESULT"
I was expecting to get 1234.
Instead the output is:
RESULT=In foo
Calculated item
1234
What is the correct way to fix this?
f() { }