💻 Software
What is the difference between executing a Bash script vs sourcing it?
Fresh5 days ago
Mar 15, 2026254871 viewsConfidence Score1%
1%
Problem
What is the difference between executing a Bash script like A and sourcing a Bash script like B?
Error Output
A > ./myscript B > source myscript
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Canonical Fix
Unverified Fix
New Fix – Awaiting Verification
Fix for: What is the difference between executing a Bash script vs sourcing it?
Low Risk
Both sourcing and executing the script will run the commands in the script line by line, as if you typed those commands by hand line by line. The differences are: When you execute the script you are opening a new shell, type the commands in the new shell, copy the output back to your current shell, then close the new shell. Any changes to environment will take effect only in the new shell and will be lost once the new shell is closed. When you source the script you are typing the commands in yo…
Awaiting Verification
Be the first to verify this fix
Sign in to verify this fix