time command 결과를 파일로 저장하기

초보개발·2022년 5월 8일
0

안된 경우

  • main.py
print("hello world45344354544")
time python3 main.py > a
  • 결과 file a

time을 사용하여 해당 파이썬 스크립트의 실행시간을 측정해보려고 했다. 하지만 standard output이 아닌지, 파일로 저장되지 않았다. -> stderr로 들어간다. 찾아본 결과 아래와 같이 변경하면 파일로 저장된다.

변경

{ time python3 main.py } 2> a

변경했더니 잘 저장되었다!

  • 결과 file a

참고

How to redirect the output of the time command to a file in Linux?

0개의 댓글