I have used 'return' to return number from shell function, Also I know 'echo' is used to return string from function.
1. return number from shell function
function test1()
{
#some handling
return 0
}
2. return string from shell function
function test2()
{
# some handling
echo "$data"
}
I have a case where I need to return both number and string from shell function.
3. return number and string from shell function
dummy algorithm
function validate()
{
var=$2
if var==something
return 1
else
# get modified varible
modifiedvar=call(var)
return 0 modifiedvar
}
validate "string"
What is the best way to do it?
returnis not used to "return" a number but to exit a function with an exit code.