 |
Assign the returned value of a function to a variable in unix shell script
The value returned by the function is stored in $? , and is not captured by $() . In
other words: testfunction() { k=5; echo 3; return $k; } val=$(testfunction) ...
stackoverflow.com |
 |