while.sh的内容:
cat while.sh
#!/bin/bash
A=1
pstree
cat 1.txt | while read line;do
#起了子进程,看如下pstree
pstree
echo $A
A=${A}_${line}
echo $A
done
echo $A
sh while.sh
├─sshd───sshd───sshd───bash───sh───pstree
├─sshd───sshd───sshd───bash───sh───sh───pstree
1
1_2
1
时间: 2024-11-10 14:21:35