Bash functions are just statements and they don't return values. Can anyone share best practice on writing functions that return values in bash?
Let's say I've a function that joins two strings:
function JoinStrings {
returnValue="$1$2"
}
How do I reuse this function in my code? How do I get returnValue
to be returned to caller? Should I just use it as a global after this function call? That leads to many errors with global variables everywhere... How to achieve code reuse in bash?