Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
常に必要なため、シェルにいくつかの変数を設定しました。変数を明示的にパラメータとして渡すことなく、シェルで定義された変数にアクセスする変数セットを持つ同じシェルで呼び出すスクリプトを作成するにはどうすればよいですか?
次のように、シェルスクリプトで割り当てを使用してスクリプトをソースするだけです。
. /path/to/settings # Dot, blank, name of file.
これにより、現在のシェルで設定の内容が実行されます (サブシェルの終了後に割り当てが失われるサブシェルの開始とは対照的です)。