管道符是fork子进程,子进程的变量无法传回父进程
[[email protected] ~]# echo "1 2 3" | read a b c;echo $a [[email protected]-v106 ~]# echo "1 2 3" | { read a b c;echo $a; } 1
read放到前面来
[[email protected] ~]# read a b c <<< "1 2 3"
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/tech/aiops/2393.html