make 2>&1
Background of this post: Recently, I always noticed that many guys can't distinguish the meaning among stdin, stdout, and stderr, especially, they always ask the same question as: what does 21 exactly mean? So, here I want to give a summar
Background of this post:
Recently, I always noticed that many guys can't distinguish the meaning among stdin, stdout, and stderr, especially, they always ask the same question as: what does "2>&1" exactly mean?
So, here I want to give a summary of this three things, and of course, I'd like to take this "2>&1" as an example.
-----------------------
Interpretation:
First of all, I want to give out the exact meaning of "2>&1":
2>&1:
0 is stdin. 1 is stdout. 2 is stderr
-------------
There's one way to remember this construct (maybe it is not entirely accurate):
-------------
First of all, 2>1 looks like a very good way to redirect stderr to stdout. but remember, it has a very harmful disadvantage: it may actually be interpreted as "redirect stderr to a file named 1".
-------------
& indicates that what follows is a file descriptor and not a filename. So the construct becomes: 2>&1.
-------------
>& is shell syntax for "fold a file descriptor into another", you can also interprete it as "it is the syntax to redirect a stream to another file descriptor"
So, now, have you got the meaning of what does "2>&1" exact mean? I think you do!
Yes, it's very easy to understand, but what's more, I want to go little deep into this topic.
-----------------------
Furthermore:
Following picture gives a very clear defination of what is stdin stdout and stderr:
# In Linux everything is a file.
# Your hardware is also a file:
* 0 - Input - Keyboard (stdin)
* 1 - Output - Screen (stdout)
* 2 - Error - Screen (stderr)
#
For standard output:
Clear
enough?
If you still feel confused about this, you can view this page to find more infomation:
http://tldp.org/LDP/abs/html/io-redirection.html
-----------------------
Example:
Finally, I want to give you a example to end this entry(Try to understand it ^_^):
The output of a.out is the following, without the 'STDXXX: ' prefix.
STDERR: stderr output<br> STDOUT: more regular
./a.out 3>&1 1>&2 2>&3 3>&- | sed 's/e/E/g'<br> more regular<br> stderr output
- First save stdout as &3 (&1 is duped into 3).
- Next send stdout to stderr (&2 is duped into 1).
- Send stderr to &3 (stdout) (&3 is duped into 2).
- close &3 (&- is duped into 3)
-----------------------
Others:
If you want to know what's the difference between "cmd >file 2>&1" and "cmd >file 2>file", pls refer this post which written by r2007:
http://bbs.chinaunix.net/thread-764727-1-1.html

핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

AI Hentai Generator
AI Hentai를 무료로 생성하십시오.

인기 기사

뜨거운 도구

메모장++7.3.1
사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전
중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기
강력한 PHP 통합 개발 환경

드림위버 CS6
시각적 웹 개발 도구

SublimeText3 Mac 버전
신 수준의 코드 편집 소프트웨어(SublimeText3)

뜨거운 주제











CSS를 사용하여 요소의 회전 배경 이미지 애니메이션 효과를 구현하는 방법 배경 이미지 애니메이션 효과는 웹 페이지의 시각적 매력과 사용자 경험을 향상시킬 수 있습니다. 이 문서에서는 CSS를 사용하여 요소의 회전 배경 애니메이션 효과를 얻는 방법을 소개하고 구체적인 코드 예제를 제공합니다. 먼저 배경 이미지를 준비해야 합니다. 배경 이미지는 태양 사진이나 선풍기 등 원하는 사진이면 됩니다. 이미지를 저장하고 이름을 "bg.png"로 지정합니다. 다음으로, HTML 파일을 생성하고 파일에 div 요소를 추가하여 다음과 같이 설정합니다.

Linux make 명령은 시스템 관리자와 프로그래머가 가장 자주 사용하는 명령 중 하나입니다. 이는 "자동 컴파일 관리자"를 의미하기도 합니다. 여기서 "자동"은 파일 타임스탬프를 기반으로 최신 파일을 자동으로 검색하고 작업 부하를 줄일 수 있음을 의미합니다. 동시에 그는 makefile 파일의 내용을 읽어 많은 양의 컴파일 작업을 수행할 수 있습니다.

PHP 개발자의 경우 POST를 사용하여 매개변수가 있는 페이지로 이동하는 것은 기본적인 기술입니다. POST는 HTTP 요청을 통해 데이터를 서버에 전송하는 방법입니다. 점프 페이지는 서버 측에서 페이지를 처리하고 점프합니다. 실제 개발에서는 특정 기능적 목적을 달성하기 위해 매개변수와 함께 POST를 사용하여 페이지로 이동해야 하는 경우가 많습니다.

PHP는 대화형 동적 웹 애플리케이션을 만드는 데 사용할 수 있는 널리 사용되는 서버측 스크립팅 언어입니다. PHP 애플리케이션을 개발할 때 일반적으로 양식을 통한 처리를 위해 사용자 입력 데이터를 서버에 제출해야 합니다. 그러나 때로는 양식 데이터가 PHP로 제출되었는지 확인해야 할 경우가 있습니다. 이 기사에서는 그러한 결정을 내리는 방법을 소개합니다.

Python은 게시물 요청을 보내는 브라우저를 시뮬레이션합니다. importrequests 형식 request.postrequest.post(url,data,json,kwargs)#post 요청 형식 request.get(url,params,kwargs)#get 요청과 비교하여 게시물 요청 보내기 매개변수는 다음과 같이 나뉩니다. form( x-www-form-urlencoded) json(application/json) 데이터 매개변수는 사전 형식과 문자열 형식을 지원합니다. 사전 형식은 json.dumps() 메서드를 사용하여 데이터를 합법적인 json 형식 문자열로 변환합니다.

1. Java가 post 인터페이스를 호출합니다. 1. java와 함께 제공되는 URLConnection 또는 HttpURLConnection을 사용합니다. 다른 jar 패키지를 다운로드할 필요가 없습니다. 서버에서 인터페이스 응답 코드를 수정하면 반환 메시지를 받을 수 없습니다. 응답 코드가 올바른 경우에만 수신할 수 있습니다. publicstaticStringsendPost(Stringurl,Stringparam){OutputStreamWriterout=null;BufferedReaderin=null;StringBuilderresult=newSt

다운로드: 서버{listen80;listen443ssl;server_namenirvana.test-a.gogen;ssl_certificate/etc/nginx/ssl/nirvana.test-a.gogen.crt;ssl_certificate_key/etc/nginx/ssl/nirvana.test-a.gogen .key;proxy_connect_timeout600;proxy_read_timeout600;proxy_send_timeout600;c

make 작동 방식 그 뒤에 숨은 메커니즘을 모르는 사람들을 위해 make 명령은 명령줄 인수와 같은 대상을 허용합니다. 이러한 대상은 일반적으로 "makefiles"라는 특수 파일에 저장되며 파일에는 대상에 해당하는 작업도 포함됩니다. 자세한 내용은 makefile 작동 방식에 대한 이 기사 시리즈를 읽어보세요. make 명령이 처음 실행되면 makefile을 스캔하여 대상과 해당 종속성을 찾습니다. 이러한 종속성 자체가 대상인 경우 이러한 종속성에 대한 makefile을 계속 검색하여 해당 종속성을 설정한 다음 컴파일합니다. 기본 종속성이 컴파일되면 기본 대상이 컴파일됩니다(make 명령을 통해 전달됨). 이제 소스 파일을 변경한다고 가정하면
