[완료] "[" 라는 실행 파일은 무엇일까요?

paradox의 이미지

/usr/bin 디렉토리 안을 살펴 보다가 파일 이름이 "[" 인 실행 파일을 봤는데

이건 어디에 쓰이는것일까요? (우분투 사용중입니다)

아시는분 답변 부탁드립니다.

ktd2004의 이미지

이건 제 경험입니다.

가끔 shell script를 짜면서 cp/mv/ln 명령을 사용하면서,
잘못 사용한 경우에 저런 형태의 파일이 생기더군요. ^^;

저는 그냥 바로 삭제합니다.

paradox의 이미지

의견 감사합니다 (/usr/bin 건들인적도 없고 서버용 컴에도 있길래 질문 올려봤네요 ^^)

hokim의 이미지

man \[ 해보시면 아시겠지만 test(check file types and compare values) 입니다

bash 쉘에서 조건문에 사용됩니다.
예를 들면

[ -e /somewhere/file ] && echo "file exist" || echo "file doesn't exist"

지우시면 안됩니다.

paradox의 이미지

아... 질문 전에 man [ 해보고 "음? 왠 test" 라고 생각하고 그냥 q 누르고 나왔는데

synopsis에 있군요 -_-a;;;

답변 감사합니다.

eseo의 이미지

제 컴퓨터에도 저런 이름이 있네요.
혹시 test 명령어와 관련이 있는것 아닐가요?
내장 test 명령이 없는 쉘을 위한 것이라던지요.

실질적으로 다음과 같이 해보았더니 동작을 하네요.

/usr/bin/[ -f file ] && echo "ok"

---
배려하는 마음을 갖자.

---
배려하는 마음을 갖자.

paradox의 이미지

답변 감사 합니다.

cjh의 이미지

FreeBSD같으면

/bin> ls -l test [
-r-xr-xr-x  2 root  wheel  7460 Jan 12 16:39 [*
-r-xr-xr-x  2 root  wheel  7460 Jan 12 16:39 test*

둘은 같은 파일인걸 아실 수 있습니다(하드링크의 수를 보세요).

리눅스는 묘하게 다르네요. (debian 3.1)

/usr/bin# ls -l test [
-rwxr-xr-x  1 root root 23928 Jul 16  2004 [
-rwxr-xr-x  1 root root 22072 Jul 16  2004 test

--
익스펙토 페트로눔

--
익스펙토 페트로눔

ironiris의 이미지

안녕리눅스는 [가 test의 솝트링크입니다~

auditory의 이미지

우분투 리눅스에서는 [ 만 치면
missing `]' 에러가 납니다.

이부분을 처리하기 위해서 차이가 나는게 아닐까요?

물론 같은 파일에서 처리하도록 할 수도 있었겠지만요..

doodoo의 이미지

허거덕....
진짜 있네요 ^^;

댓글 달기

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
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.