测试脚本:
#!/bin/sh flag=0 func() { flag=1 echo 123 } main() { func | grep 123 echo "flag=$flag" }
输出显示的flag=0!
参考:https://www.cnblogs.com/super119/archive/2010/12/18/1909829.html
测试脚本:
#!/bin/sh flag=0 func() { flag=1 echo 123 } main() { func | grep 123 echo "flag=$flag" }
输出显示的flag=0!
参考:https://www.cnblogs.com/super119/archive/2010/12/18/1909829.html