Curiosity, learning and homework help
20/10/2021
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...

Different ways to run a script
There exist several ways to run a script in a shell.

  • Execute 'script' if it is executable and located in the current directory:
  • ./script

    ./ means the current directory. It is necessary to specify it because usually the current directory is not in the $PATH variable.

  • Execute 'script' if the file is executable and located in a directory listed in the $PATH variable:
  • script

  • Source 'script' :
  • source script

    The file does not need to be executable but must be a valid shell script. The file can be in the current directory or a directory listed in the $PATH variable.

  • Source 'script' (syntax variant) :
  • . script

    'source' is an alias of the command '.' defined by bash and other shells.

However, executing a script and sourcing a script are two different operations: Difference between "execute" a script and "source" a script.

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.