2025-11-07
2025-11-07 ~ 2025-11-07
The note is generated by “ChatGPT”.
🔹 source
- Executes a script in the current shell environment.
- Does not create a new shell process.
- All variable exports, alias definitions, and PATH modifications remain active after execution.
- Commonly used for reloading configuration files (e.g.,
source ~/.bashrc). - Bash and Zsh built-in command.
Example:
| |
→ Reloads your Bash configuration immediately in the current session.
🔹 bash
- Starts a new Bash subshell to run the script.
- The parent shell does not inherit any environment changes.
- Safer for running scripts that should not affect your current session.
- Suitable for installation, automation, or isolated execution.
Example: