#TIL #bash find 명령어 결과에서 permission denied 에러 메시지 숨기기

$ find / -name 'to_be_searched.file'

permission denied 메시지 작렬. 뭘 보지를 못하겠네. 이 메시지만 걸러내는 방법은 없을까?

$ find / -name 'to_be_searched.file' 2>/dev/null

간단하다. stderr(standard error)널 디바이스(null device)로 리다이렉션하면 된다.

에러 메시지 출력에 std::cerr 안 쓰고 std::cout 썼다면 망. linux 커맨드라인 유틸리티 바닥은 칼같이 지켜서 stderr를 리다이렉션만 하면 된다.

참고

Feedback plz <3 @ohyecloudy, ohyecloudy@gmail.com

A Random Post