다음과 같은 스크립트 :
exec &> >(tee -a ./test_tee.log)
ping $1
스크립트가 bash 7603에서 실행 중일 때 exec 라인은 다음과 같이 이름이 13069인 프로세스를 생성합니다.
root 13068 7603 0 17:15 pts/5 00:00:00 bash
root 13069 13068 0 17:15 pts/5 00:00:00 bash // where does it come from
root 13070 13068 0 17:15 pts/5 00:00:00 ping google.com
root 13071 13069 0 17:15 pts/5 00:00:00 tee -a ./test_tee.log
pid 7603 bash에서 스크립트를 실행했는데 pid 13068이 스크립트인데 왜 pid 13069가 있습니까?
답변1
추가 프로세스는 tee -a ./test_tee.log
. 로 이를 확인하세요 pstree -p | grep -B 1 '[t]ee'
.
이 서브쉘에 다음을 지시할 수 있습니다.바꾸다. tee
관련 줄을 다음으로 변경합니다.
exec &> >(exec tee -a ./test_tee.log)