bash Bash中“.filename”(句点空间文件名)是什么意思?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17014478/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is the meaning of ". filename" (period space filename) in Bash?
提问by Muhammad Raihan Muhaimin
What does a command with format [period][space][filename] mean?
格式为 [句号][空格][文件名] 的命令是什么意思?
Example:
例子:
. ./setup.sh
Also in the .bashrcfile, we have a line like that:
同样在.bashrc文件中,我们有这样一行:
. "$HOME/.bashrc"
What does this mean?
这是什么意思?
采纳答案by Muhammad Raihan Muhaimin
The .operator is also known as source.
该.操作也被称为source。
According to this forum thread, the first .is the command sourceto read and execute commands from the filename given as argument.
The second .is the current directory.
根据这个论坛帖子,第一个.是source从作为参数给出的文件名中读取和执行命令的命令。第二个.是当前目录。
. ./setup.sh
is the same as
是相同的
source ./setup.sh
or
或者
source setup.sh
if the ./, the current directory, is in the PATHenvironment variable.
如果./当前目录 位于PATH环境变量中。
Here is the manual for that: http://ss64.com/bash/source.html
这是手册:http: //ss64.com/bash/source.html
This is typically used to run the script in the current shell to help set up the environment for execution, as well as to set up aliases.
这通常用于在当前 shell 中运行脚本以帮助设置执行环境,以及设置别名。

