如果学习过高级语言比如java和c语言等,此时你要是获取一个函数的返回值,直接在函数里面写上return即可,然后在函数执行时将返回结果赋值给某个变量即可.但是在shell脚本中限制较多,因此如果我们想实现这样的功能的话,稍微困难一些,本人在实践中做了一些该方面的实验,并做笔记分享. shell脚本的返回值可以使用return参数,但是return只能返回整数类型的值.因此实现比较复杂的功能的话shell脚本可能不太友好. 比如下面这个例子: #!/bin/bash function in_pa