Skip to content

Commit ef458ba

Browse files
authored
Ch06: Add "cd" to "source" command effects (#70)
1 parent e87f169 commit ef458ba

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/Ch06/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ drwxr-xr-x 2 ustc ustc 4096 11月 17 20:45 模板/
366366

367367
!!! tip "关于 `.` 命令"
368368

369-
与直接执行脚本,或者指定 shell 执行脚本不同,使用 `.` 命令执行脚本会在当前 shell 中执行脚本,而不是新建一个 shell 去执行脚本。这意味着,脚本中的变量定义、函数定义等都会在当前 shell 中生效。
369+
与直接执行脚本,或者指定 shell 执行脚本不同,使用 `.` 命令执行脚本会在当前 shell 中执行脚本,而不是新建一个 shell 去执行脚本。这意味着,脚本中的变量赋值、函数定义以及切换目录(`cd` 命令)等变化都会在当前 shell 中生效。
370370

371371
在 bash 中,`source` 命令与 `.` 命令等价。有些情况下,使用 `.` 执行脚本是有必要的,例如在激活 Python 的虚拟环境时:
372372

0 commit comments

Comments
 (0)