"/usr/bin/[" 의 용도는?

지리즈의 이미지

rpm -ql sh-utils
하니까 지금까지 몰랐던 것들이 쭈루룩 나오더군요..

특히 tee는 재미있었습니다.
yes도 황당하더군요 이런 건 어디다 쓰는 걸까요? ㅋㅋ

근데 제일 궁금한 것은
"usr/bin/["
였습니다.

[admin@ns bin]$pwd
/usr/bin
[admin@ns bin]$ ls -al [
lrwxrwxrwx    1 root     root            4 May 12 22:16 [ -> test

[admin@ns admin]$ ls -al /usr/bin/[
lrwxrwxrwx    1 root     root            4 May 12 22:16 /usr/bin/[ -> test
[admin@ns admin]$ test .bash_profile
[admin@ns admin]$ [ .bash_profile
[: missing `]'
[admin@ns admin]$ /usr/bin/[ .bash_profile
[admin@ns admin]$ [
bash: [: missing `]'
[admin@ns admin]$ test
[admin@ns admin]$ 

조건 연산자 .[]의 [와 겹치는데 무슨 의도로 이런 심볼릭링크를 만들었을까요?

지리즈의 이미지

추가로 yes는 무슨 용도로 쓰이는지 혹 아십니까?
상사한테 항의하려는 의도 였을까요?

yes > /dev/pty/x <- 상사의 pty

Quote:
상사>일해...
직원>싫어여...
상사>사표쓸래?
직원>...
상사>그럼 일해...
직원>yes > 상사

There is no spoon. Neo from the Matrix 1999.

지리즈의 이미지

헉 man test 해보니까
그 궁금중이 다 해결되는 군요...
이제
yes만 남았다.

There is no spoon. Neo from the Matrix 1999.

zltek의 이미지

혹시 커널 컴파일 같은거 할 때 쓰이는게 아닐까요?
yes > make config

"no error was found with his codes"

Mins의 이미지

Quote:

이제 멋진 yescat을 소개한다. /usr/bin/yes는 /usr/bin 구석진 곳에 오랜동안 조용히 있어서 리눅스 세계에 늦게 들어온 사람은 발견하지 못했을 것이다. 기원은 신비에 싸여있다. /sbin/init 만큼 인기가 있다! 그럼 무엇을 하는가? 우리 눈으로 직접 보자.

zw@q ~ % yes
y
y
y
y
y
y
y

놀랍지 않은가? ;-) (y를 중단하기위해 ctrl-C를 누른다. 안그러면 화면이 계속 아래로 내려간다.) no라고 말할 수도 있다!

zw@q ~ % yes no
no
no
no
no
no

http://www.whiterabbitpress.com/lg/issue74/zhaoway.html
이곳 링크에 설명이 약간 나오네요.
단순하게 yes 와 no 를 계속 뿌려주는 역활을 하는군요.
참 재미난 명령 같은데 써먹어 본적은 없네요. 혹시나 노가다성 작업을 할때 도움이 될런지도. :)

세이군의 이미지

간단하게 yes명령의 사용법을 보여드리지요..
# rm -rf *
# yes | rm -r *

위 두 명령이 같은 역할을 합니다.
계속되는 질문에 자동으로 yes라고 대답하게 하는 것이 yes명령인거지요..

mach337의 이미지

test 의 링크입니다.

man test 했을때 SYNOPSIS 에 나오죠.

test 와 다른것은 [ 을 사용했을때는 ] 가 있어야 한다는 것입니다.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.