“"的含义是什么.文件名" (时段空间文件名)在Bash中?

问题描述:

格式为[period] [space] [filename]的命令是什么意思?

What does a command with format [period][space][filename] mean?

示例:

. ./setup.sh

.bashrc文件中,也有这样一行:

Also in the .bashrc file, we have a line like that:

. "$HOME/.bashrc"

这是什么意思?

.运算符也称为source.

根据此论坛主题,第一个.是命令source,用于从作为参数给出的文件名中读取和执行命令. 第二个.是当前目录.

According to this forum thread, the first . is the command source to read and execute commands from the filename given as argument. The second . is the current directory.

. ./setup.sh

source ./setup.sh

source setup.sh

如果当前目录./PATH环境变量中.

if the ./, the current directory, is in the PATH environment variable.

此处是该手册: http://ss64.com/bash/source.html

通常用于在当前shell中运行脚本,以帮助设置执行环境以及设置别名.

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.