Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
return从和返回的代码exit是相同的,关键字只是在不同的上下文中使用(return用于从函数和源返回,exit用于退出当前 shell)。
return
exit
它们本身不会相互干扰,但是有exit或return没有参数将使用前一个命令的返回值,该值可能已在另一个exitorreturn语句中指定。