Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[20210226] /dev/null 2>&1, GCP - Docker, Jenkins #51

Open
JuHyun419 opened this issue Feb 26, 2021 · 0 comments
Open

[20210226] /dev/null 2>&1, GCP - Docker, Jenkins #51

JuHyun419 opened this issue Feb 26, 2021 · 0 comments

Comments

@JuHyun419
Copy link
Owner

JuHyun419 commented Feb 26, 2021

Linux - /dev/null 2>&1

// 표준 출력을 /dev/null 로 redirection 하라는 의미, 표준출력을 버리라는 의미
$ rm test > /dev/null
  • test라는 file이 존재하지 않으면 표준에러 가 출력됨
$ rm test > /dev/null 
rm: cannot remove 'test' : No such file or directory
  • "표준출력" 이 아닌 "표준에러"이므로 화면에 출력이 된다.
  • 즉, 위 명령어에서 /dev/null로 redirection을 통해 화면에 출력하지 않는 것은 표준출력에 한해서이다.
// 2: 표준에러, >: 리다이렉트, &1: 표준출력
$ rm > test > /dev/null 2>&1
  • 2>&1 는 표준에러를 표준출력으로 redirect 하라는 의미
  • 0 : 표준입력, 1 : 표준출력, 2 : 표준에러
  • 즉, rm test의 표준출력을 /dev/null로 버리는데, 표준에러는 표준출력으로 redirection 함
  • 그 결과 표준출력이 되기 때문에 /dev/null로 버려지고, 화면에 결과가 뿌려지지 않는 것

GCP - Docker, Jenkins 배포

References

https://jybaek.tistory.com/115
https://blog.daum.net/mcchijun/15418625

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant