이 질문에 이미 답변이 있습니다  : 
 댓글 
 Answer 
 모든 세션의 모든 출력을 캡처하는 방법은 새 bash 세션을 시작하고 로그 파일로 이동하는 것입니다. 스크립트보다 더 많은 것을 추적하는 데 정말 유용합니다. 
 bash | tee ~/bash.log #this will save standard output until the bash session is ended bash | tee ~/bash.log 2>&1 #this will save all output including errors until the bash session is ended 
 또는 스크립트 자체를 직접 입력 할 수 있습니다. 
 ./myscript.sh | tee ./myscript.log #this will log only the output of the script. 
 댓글 
 
 Answer 
 언제든지 스크립트 내에서 script를 호출하여 모든 것을 기록합니다. 
 bash 스크립트에서 동시에 모든 것을 인쇄하고 기록하려면 log.txt : 
 로그보기 log.txt : 
$ ./a.sh Script started, output file is log.txt teste Script done, output file is log.txt $ cat log.txt Script started on Fri Feb 16 17:57:26 2018 command: /bin/bash -c ./a.sh teste Script done on Fri Feb 16 17:57:26 2018 
 댓글 
 
 답변 
  티 를 사용하려고합니다. 
 예 : 
echo "Hello World" | tee out.txt 
 명령의 출력을 사용하여 out.txt 파일을 생성하고 화면에 인쇄합니다. 파일에 추가하려면 “tee -a filename”을 사용하십시오. 
echo "Hello" | tee -a out.txt echo "World" | tee -a out.txt 
 out.txt에는 Hello와 World 두 줄이 있습니다 (-a없이 전체 스크립트를 저장하고 전체 스크립트를 출력하려는 경우 : 
./script.sh | tee output.txt 
 댓글