Last updated 5 years ago
Was this helpful?
在Shell中,会使用
如果在function中,有某些判断后结束function不再执行后面部分,例如:
function
则应该使用return [n]方法,从help return可以看到:
return [n]
help return
return可以从一个shell函数中返回指定的n数值。如果没有指定n,则返回值是函数或脚本最后执行命令的返回值。
return
n
fuction func_1(){ .... }
# Start script Do scripty stuff here Ok now lets call FUNCT FUNCT Here is A to come back to function FUNCT { if [ blah is false ]; then exit the function and go up to A else keep running the function fi }