Answers for "Shell return"

0

Shell return

function myfunc()
{
    local  __resultvar=$1
    local  myresult='some value'
    if [[ "$__resultvar" ]]; then
        eval $__resultvar="'$myresult'"
    else
        echo "$myresult"
    fi
}

myfunc result
echo $result
result2=$(myfunc)
echo $result2
Posted by: Guest on October-06-2021

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language