본문 바로가기
IT/linux

csh stderr redirection

by 어느해겨울 2022. 9. 4.

 

csh 환경에서 stderr redirection

xargs grep 을 통해 특정 키워드 탐색 시 stderr redirection을 하지 않으면 디렉토리 관련 오류 메시지를 현시한다.
이런 경우 stderr 메시지를 /dev/null 경로로 redirection 하여 키워드가 포함된 결과만 확인할 수 있다.

 

e.g.) 현재 경로 하위에서 내용 중 lib-release 라는 키워드를 찾고 싶을 때 사용

csh 환경
(find . | xargs grep "lib-release" > /dev/tty) >& /dev/null
 
 
bash 활용
bash -c 'find . | xargs grep "lib-release" 2> /dev/null'
 

 

댓글