#!/bin/bash
function doSomething() {
callee
echo $?
echo "It should go to here!"
}
function callee() {
cat line.txt |while read ln
do
echo $ln
if [ 1 ] ;then
{ echo "This is callee" &&
return 2; }
fi
done
echo "It should not go to here!"
}
doSomething
阅读下面是结果bash return在回声“aa”|中不能正常工作而LN
aa
This is callee
It should not go to here!
0
It should go to here!
为什么 “回归” 的工作原理是 “破发”?
我希望它退出该功能!不仅打破循环...
OP的另一个原因是为了避免UUOC(无用猫)奖。 –
该死的好~~~ !!! – wenchiching