[완료] find에서 comma 연산자

nomail의 이미지

안녕하세요.
find 명령어 중에 ,(comma) 연산자가 있는데 맨페이지를 읽고 테스트 해보면 의도한대로 동작하지 않습니다.

find -name config , size +10k

맨페이지 설명대로라면, 파일명이 config 인 것과, 사이즈가 10k 이상인 모든 목록을 표시한다는 뜻이잖습니까?

그런데 size +10k 이 명령만 인식됩니다.

혹시 제가 잘못알고 있는거라면 설명을 좀 부탁드립니다.

익명 사용자의 이미지

       expr1 expr2
	      Two expressions in a row are taken to be joined with an  implied
	      "and"; expr2 is not evaluated if expr1 is false.
 
       expr1 -a expr2
	      Same as expr1 expr2.
 
       expr1 -and expr2
	      Same as expr1 expr2, but not POSIX compliant.
 
       expr1 -o expr2
	      Or; expr2 is not evaluated if expr1 is true.
 
       expr1 -or expr2
	      Same as expr1 -o expr2, but not POSIX compliant.
 
       expr1 , expr2
	      List;  both  expr1 and expr2 are always evaluated.  The value of
	      expr1 is discarded; the value  of	 the  list  is	the  value  of
	      expr2.	   The	comma operator can be useful for searching for
	      several different types of thing, but traversing the  filesystem
	      hierarchy	 only  once.   The -fprintf action can be used to list
	      the various matched items into several different output files.

콤마 쓰면 앞쪽은 버린다는 것 같습니다.

nomail의 이미지

덧글 고맙습니다.
제가 맨페이지를 대충 읽었군요.
맨페이지 example 쪽을 보니까 사용법을 정확히 알 것 같습니다.
결국은 콤마의 마지막 부분만 평가식으로 사용되고 앞쪽의 연산식에서는 ls나 print, delete, exec로 다른 작업을 할 수 있다는 거네요.

dontdieych의 이미지

오타일 것 같지만 혹시나 해서,

size +10K -> -size +10K

'-' 기호가 빠진 것 같습니다.

원하시는 결과는 '-or'를 사용해야 될 것 같습니다.

find -name config -or -size +10K

nomail의 이미지

덧글 고맙습니다^^
지적해주신 대로 하이픈이 빠진건 오타가 맞습니다.
알려주신 내용도 도움 많이 되었습니다^^

댓글 달기

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