March 5, 2018
Shell: 获取函数返回值, Returning value from called function in a shell script
shell函数不能直接返回字符串,用以下三种方式代替!
A Bash function can’t return a string directly like you want it to. You can do three things:
Echo a string
Return an exit status, which is a number, not a string
Share a variable
This is also true for some other shells.
Here’s how to do each of those options:
1. Echo strings
lockdir="somedir"
testlock(){
retva… Read