天天看點

shell中的source指令和點号dot/period

在目前環境下讀取和執行filename中的指令。

Read and execute commands from the filename argument in the current shell context.

Syntax

. filename [arguments]
      source filename [arguments]
           

點号是source的同義詞。

Why this article?

以前隻知道,在目前shell環境下導入另一個腳本中的變量或者函數使用指令:

. filename
           

後來看到有些地方用到指令:

source filename
           

它們的意思和效果是完全一樣的。

參考:http://ss64.com/bash/period.html