Curiosity, learning and homework help
20/10/2021
Sign upLog in
Language: FR | ENG

:

### 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.

Questions, comments?
Quick comments
There is no comment yet.