do command followed…
the first cmd give $! which is sub bash process pid but the second cmd git $! which is real cmd(test_link.sh)’s pid, why?
sea@sea-PC:~$ (cd /mnt/sda/tcpdump_monitor && ./mnt/sda/tcpdump_monitor/test_link.sh) &
[1] 69149
sea@sea-PC:~$ ps -ef | grep link
sea 69150 69149 0 10:31 pts/1 00:00:00 /bin/bash /mnt/sda/tcpdump_monitor/test_link.sh
sea@sea-PC:~$ bash -c “cd /mnt/sda/tcpdump_monitor && ./mnt/sda/tcpdump_monitor/test_link.sh” &
[1] 69176
sea@sea-PC:~$ ps -ef | grep link
sea 69176 68860 0 10:32 pts/1 00:00:00 /bin/bash /mnt/sda/tcpdump_monitor/test_link.sh
sea 69183 68860 0 10:33 pts/1 00:00:00 grep scfs
the diffrence between the two commands and why the diffrence for the recent backend pids?
liang cheng is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.