![점(.)이 소스의 별칭으로 사용되는 이유는 무엇이며 다른 명령에는 단축키가 없는 이유는 무엇입니까? [폐쇄]](https://linux55.com/image/137737/%EC%A0%90(.)%EC%9D%B4%20%EC%86%8C%EC%8A%A4%EC%9D%98%20%EB%B3%84%EC%B9%AD%EC%9C%BC%EB%A1%9C%20%EC%82%AC%EC%9A%A9%EB%90%98%EB%8A%94%20%EC%9D%B4%EC%9C%A0%EB%8A%94%20%EB%AC%B4%EC%97%87%EC%9D%B4%EB%A9%B0%20%EB%8B%A4%EB%A5%B8%20%EB%AA%85%EB%A0%B9%EC%97%90%EB%8A%94%20%EB%8B%A8%EC%B6%95%ED%82%A4%EA%B0%80%20%EC%97%86%EB%8A%94%20%EC%9D%B4%EC%9C%A0%EB%8A%94%20%EB%AC%B4%EC%97%87%EC%9E%85%EB%8B%88%EA%B9%8C%3F%20%5B%ED%8F%90%EC%87%84%5D.png)
편집하다:실제로 별칭이 아닙니다(답변 참조).
우리 모두 알고 있듯이 쉘에서 도트 명령( .
)은 소스 명령의 별칭입니다.
그런데 이렇게 이상한 별명 뒤에 숨은 이유가 있는지 궁금합니다. 당연히 자주 사용하지 않기 때문에 이렇게 짧은 별칭이 필요합니다.
그렇다면 점을 추가하는 이유는 무엇입니까? 또는 와 source
같이 더 일반적으로 사용되는 명령 대신 왜 필요한가요 ? 별칭이 왜 필요한가요? 이것 뒤에 타당한 이유가 있습니까? 아니면 역사적인 이유가 있나요?cd
ls
노트:이 질문은 원래 서버 오류에 게시했지만 여기에 게시하자는 제안을 받았습니다.
답변1
.
~이다POSIX 표준.
source
bash의 내장 동의어이며 .
다음과 다릅니다..
또한 Bash 참조 매뉴얼에는 다음이 .
나열되어 있습니다.4.1 Bourne Shell 내장 기능source
아래 병치4.2 Bash 내장 명령처럼:
동의어. (Bourne Shell 내장 기능 참조)
source
아마도 C 셸(명령이 파생된 것으로 보이는)에서 bash라고 부르기 때문에 이름이 bash로 지정된 것 같습니다 .
답변2
Bash에 관한 한 둘 중 하나의 별칭이 .
아니며 source
둘 다 동일한 기본 함수를 호출하는 내장 함수라는 것은 단순한 사실입니다 source_builtin
.
source.def
Bash 소스 코드의 파일을 살펴보세요 .
$PRODUCES source.c
$BUILTIN source
$FUNCTION source_builtin
$SHORT_DOC source filename [arguments]
Execute commands from a file in the current shell.
Read and execute commands from FILENAME in the current shell. The
entries in $PATH are used to find the directory containing FILENAME.
If any ARGUMENTS are supplied, they become the positional parameters
when FILENAME is executed.
Exit Status:
Returns the status of the last command executed in FILENAME; fails if
FILENAME cannot be read.
$END
$BUILTIN .
$DOCNAME dot
$FUNCTION source_builtin
$SHORT_DOC . filename [arguments]
Execute commands from a file in the current shell.
Read and execute commands from FILENAME in the current shell. The
entries in $PATH are used to find the directory containing FILENAME.
If any ARGUMENTS are supplied, they become the positional parameters
when FILENAME is executed.
Exit Status:
Returns the status of the last command executed in FILENAME; fails if
FILENAME cannot be read.
$END
인용하다
답변3
도트 명령은 아마도 1976년 Bourne Shell에 의해 도입되었을 것입니다.
source 명령은 1977년 또는 1978년에 csh에 의해 도입되었습니다.
따라서 "발명품"은 별칭 관계가 없고 동시에 두 개의 서로 다른 이름을 가지고 있습니다.
cd
참고: 이름이 왜 그런 식으로 지정되었는지 말씀드릴 수 있습니다 . 이 명령은 이전에 호출되었지만 chdir
1974년에 출시된 110 보드 모뎀에 비해 너무 길고 입력 속도가 느렸습니다...