매뉴얼 페이지의 개요 섹션에 있는 명령의 경로가 다른 이유는 무엇입니까?

매뉴얼 페이지의 개요 섹션에 있는 명령의 경로가 다른 이유는 무엇입니까?

매뉴얼 페이지를 보면 grep이 명령에 대해 두 가지 다른 경로가 있다는 것을 알았습니다. 이는 grep내 시스템에 여러 도구가 있다는 뜻인가요 ? 동일한 경로의 개요 줄은 동일한 도구의 다른 사용 예입니까? 나는 사용하고있다OS X 10.10.5

NAME
     grep - search a file for a pattern

SYNOPSIS
     /usr/bin/grep [-bchilnsvw] limited-regular-expression
          [filename]...

     /usr/xpg4/bin/grep [-E | -F] [-c | -l | -q] [-bhinsvx] -e pattern_list...
          [-f pattern_file]... [file]...

     /usr/xpg4/bin/grep [-E | -F] [-c | -l | -q] [-bhinsvx]
          [-e pattern_list]... -f pattern_file... [file]...

     /usr/xpg4/bin/grep [-E | -F] [-c | -l | -q] [-bhinsvx] pattern
          [file]...

DESCRIPTION
     The grep utility searches  text  files  for  a  pattern  and
     prints  all lines that contain that pattern.  It uses a com-
     pact non-deterministic algorithm.

후속 질문: 매뉴얼 페이지는 어디에서 왔습니까? 동적으로 생성됩니까, 아니면 정적 설치의 일부입니까?

답변1

macOS 컴퓨터를 사용하고 있다고 하는데 설명서가 의심스럽습니다.grepSolaris 시스템 매뉴얼.grep비교를 위한 OSX 10.9 매뉴얼은 다음과 같습니다..

Solaris에는 여러 가지 구현을 갖춘 여러 유틸리티가 있으며 이것이 grep그 중 하나입니다. 내용은 /usr/bin"X/Open Portability Guide, Issue 3"의 약어인 XPG3를 따릅니다. Single Unix 사양은 XPG4를 기반으로 합니다(참조:WikipediaX/기사 열기)

grep예를 들어 XPG3은 /usr/bin확장 정규식을 지원하지 않지만 XPG4 grep/usr/xpg4/bin.

유틸리티의 매뉴얼에 여러 개요 줄이 있는 경우 이러한 개요 줄은 일반적으로 유틸리티를 호출하는 상호 배타적인 방법을 설명합니다.

이것들:

/usr/xpg4/bin/grep [-E | -F] [-c | -l | -q] [-bhinsvx] -e pattern_list...
      [-f pattern_file]... [file]...

 /usr/xpg4/bin/grep [-E | -F] [-c | -l | -q] [-bhinsvx]
      [-e pattern_list]... -f pattern_file... [file]...

-e.. 또는 -f둘 중 하나를 사용할 수 있음을 나타냅니다 .~ 해야 하다다음 중 하나를 사용하세요.

마지막 하나,

 /usr/xpg4/bin/grep [-E | -F] [-c | -l | -q] [-bhinsvx] pattern
      [file]...

...은 nor -enor 를 사용하지 않는 -f경우 pattern명령줄에서 지정해야 함을 나타냅니다.

당신은 또한 볼 수 있습니다standards(5)솔라리스에서.


매뉴얼은 "정적으로" 설치됩니다. 즉, man명령으로 읽고 표시되는 별도의 파일로 설치됩니다. 그러나 시스템에 따라 이들 중 일부는 groff소스 mandoc파일일 수 있고 다른 일부는 텍스트 파일로 미리 형식화되어 있을 수 있으며 때로는 일반적으로 cat. man시스템의 설명서( )를 읽고 man man처리 방법을 알아보세요.

/usr/share/man대부분의 경우 설명서는 /usr/local/share/man, , 또는 유사한 위치에서 찾을 수 있습니다.

답변2

매뉴얼 페이지의 형식은 동적이지만 내용은 정적입니다. 실제 사전 형식화된 매뉴얼 페이지의 위치를 ​​포함한 구성은 일반적으로 /etc/man.conf.

내 MacOS 컴퓨터의 관련 부분:

# Every automatically generated MANPATH includes these fields
#
MANPATH   /usr/share/man
MANPATH   /usr/local/share/man
MANPATH   /usr/X11/man
#
# Uncomment if you want to include one of these by default
#
# MANPATH /opt/*/man
# MANPATH /usr/lib/*/man
# MANPATH /usr/share/*/man
# MANPATH /usr/kerberos/man
#
# Set up PATH to MANPATH mapping
#
# If people ask for "man foo" and have "/dir/bin/foo" in their PATH
# and the docs are found in "/dir/man", then no mapping is required.
#
# The below mappings are superfluous when the right hand side is
# in the mandatory manpath already, but will keep man from statting
# lots of other nearby files and directories.
#
MANPATH_MAP   /bin            /usr/share/man
MANPATH_MAP   /sbin           /usr/share/man
MANPATH_MAP   /usr/bin        /usr/share/man
MANPATH_MAP   /usr/sbin       /usr/share/man
MANPATH_MAP   /usr/local/bin      /usr/local/share/man
MANPATH_MAP   /usr/local/sbin     /usr/local/share/man
MANPATH_MAP   /usr/X11/bin        /usr/X11/man
MANPATH_MAP   /usr/bin/X11        /usr/X11/man
MANPATH_MAP   /usr/bin/mh     /usr/share/man

그래서 그것을 보면 매뉴얼 페이지가 무엇인지 정의하고 있다는 것을 /usr/share/man/man1알 수 있습니다 .grep.1grep(1)

관련 정보