Curiosity, learning and homework help
28/03/2024
Sign upLog in
Language: FR | ENG

NEWSLETTER

:

MEMBERS

Come to discuss on the forum!
 FAST and FREE signup. 
😀 Access to discussion forums 😀
Help for HOMEWORKS, support in COMPUTER SCIENCE, help for learning FRENCH and ENGLISH, discussion on your INTERESTS and HOBBIES...

Following numerous requests, a new forum on PIPENET Vision has been created!

Difference between "execute" a script and "source" a script
To launch a script and run it line by line, you have to either source it or execute it: Different ways to run a script.

  • Sourcing : allows to launch a command in the process of the current shell.

  • Executing : allows to launch a command in a new shell.

Here is a summary of the differences between sourcing and executing:
ExecutingSourcing
  • launch a new shell process
  • run the commands in this new shell
  • run the commands in the current shell
  • copy the outputs in the current shell
  • close the new shell
  • send the outputs in the current shell
  • the changes in the environment are not taken into account in the new shell and will be lost at the closure of this new shell
  • the changes in the environment are taken into account in the current shell and will remain after the run
  • you need to have the execution rights on the script
  • it is not necessary to have the execution rights

So if you want your script to change the environment of the current shell, you have to source. Otherwise, you have to execute.
Share this page on social media:
Quick comments
There is no comment yet.

Use of cookies on this website:
- If you are not a member of this website, no cookie is intentionally stored on your computer.
- If you are a member of this website, cookies are only used to keep your connection after each visit. This option can be deactivated at will in your profile and is deactivated by default.
- No other information is stored or retrieved without your knowledge, neither your personal information nor any other whatsoever. If in doubt, do not hesitate to contact the administrator of this website .
- Even this information banner does not use cookies and will therefore be displayed constantly on each visit on all pages of the website.