經安全檢測,此網站為安全網站,請放心前往原始網址!

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

網址安全性掃描由 google 提供