# part of the file ~/.bashrc
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
其中. ~/.bash_aliases的第1个小数点是什么意思
这个小数点有什么用处
-
- 帖子: 174
- 注册时间: 2010-11-09 3:06
- dreamcast_sh
- 帖子: 480
- 注册时间: 2009-06-14 22:16
-
- 帖子: 3030
- 注册时间: 2009-10-03 23:31
Re: 这个小数点有什么用处
这一句,如果不加.将启动一个子shell解释并执行.bash_aliases文件,加了.就在当前shell解释并执行.bash_aliases(准确地说,是在当前shell进程中从文件读取并执行其中的命令并获取返回值)。. ~/.bash_aliases
上次由 levee 在 2011-07-24 12:31,总共编辑 1 次。
-
- 帖子: 174
- 注册时间: 2010-11-09 3:06
Re: 这个小数点有什么用处
谢谢levee 写了:这一句,如果不加.将启动一个子shell解释并执行.bash_aliases文件,加了.就在当前shell解释并执行.bash_aliases。. ~/.bash_aliases
- ChenFengyuan
- 帖子: 770
- 注册时间: 2008-03-23 0:39
Re: 这个小数点有什么用处
man dash
man bash. file
The commands in the specified file are read and executed by the shell.
man zshbuiltins. filename [arguments]
source filename [arguments]
Read and execute commands from filename in the current shell environ‐
ment and return the exit status of the last command executed from
filename. If filename does not contain a slash, file names in PATH
are used to find the directory containing filename. The file
searched for in PATH need not be executable. When bash is not in
posix mode, the current directory is searched if no file is found in
PATH. If the sourcepath option to the shopt builtin command is
turned off, the PATH is not searched. If any arguments are supplied,
they become the positional parameters when filename is executed.
Otherwise the positional parameters are unchanged. The return status
is the status of the last command exited within the script (0 if no
commands are executed), and false if filename is not found or cannot
be read.
. file [ arg ... ]
Read commands from file and execute them in the current shell envi‐
ronment.
If file does not contain a slash, or if PATH_DIRS is set, the shell
looks in the components of $path to find the directory containing
file. Files in the current directory are not read unless `.' appears
somewhere in $path. If a file named `file.zwc' is found, is newer
than file, and is the compiled form (created with the zcompile
builtin) of file, then commands are read from that file instead of
file.
If any arguments arg are given, they become the positional parame‐
ters; the old positional parameters are restored when the file is
done executing. The exit status is the exit status of the last com‐
mand executed.
- jarlyyn
- 帖子: 4671
- 注册时间: 2006-04-12 18:54
- 联系:
-
- 帖子: 6
- 注册时间: 2011-06-23 20:51
Re: 这个小数点有什么用处
当我们编辑完一个脚本文件后希望其立即生效。
方法一: 重启shell
方法二: 重启系统
方法三: $ . ./xxx.sh 或者 $ source ./xxx.sh
. 与 source 等价.

方法一: 重启shell
方法二: 重启系统
方法三: $ . ./xxx.sh 或者 $ source ./xxx.sh
. 与 source 等价.
