How Shell Script Is Sourced in Linux?

How Shell Script Is Sourced in Linux?
Contents

How do you source a script in Linux?

source is a shell built-in command which is used to read and execute the content of a file(generally set of commands), passed as an argument in the current shell script. The command after taking the content of the specified files passes it to the TCL interpreter as a text script which then gets executed.

What is sourcing a shell script?

Sourcing a script will run the commands in the current shell process. Executing a script will run the commands in a new shell process. … This will execute myscript provided that the file is executable and located in the current directory. The leading dot and slash (./) denotes the current directory.

Sophia Al-Mansoor
Author

Sophia Al-Mansoor

Sophia analyzes international trade, startup ecosystems, retail transformation, and supply chain logistics for modern digital publications.