The below code snippet shows how to return the value to the function calling and how to override the delcared variable value.
funReturn1()
{
x=10;
echo "$x"
}
rvalue=`funReturn1`
echo -e "function funReturn return rvalue = $rvalue\n"
y=10;
funReturn()
{
y=20;
return;
}
funReturn
echo -e "function funReturn return y = $y\n"
OUTPUT :
-bash-3.2$ sh func_return
function funReturn return rvalue = 10
function funReturn return y = 20
-bash-3.2$
Explanation :
function funReturn1 is just return the value to the function calling and assign the return value into rvalue variable here only one echo statement is used dont use more than one echo statement.
y=10; # declared the value in global
funReturn()
{
y=20; # here the value y=10 is reassigned to y=20 after the function call the value should be updated to y=20
return;
}
funReturn
A Language is not worth knowing unless it teaches you to think differently.
Subscribe to:
Post Comments (Atom)
Price List Query for Item
SELECT qph.list_header_id, qph.name, qph.description, qphh.start_date_active, qphh.currency_code, q...
-
1. To download Ldt file for a Concurent Program FNDLOAD [username]/[password] O Y DOWNLOAD $FND_TOP/patch/115/import/afcpprog.lct file_nam...
-
Here the article will describe about how to register WebADI to Responsibility menu Go to System Administrator --> Security --> Respo...
-
using the below query can check the invoice status. SELECT DECODE(AP_INVOICES_UTILITY_PKG.GET_APPROVAL_STATUS(AIA.INVOICE_...
No comments:
Post a Comment