Include Files in Bash

Include Files in Bash

 Include Files in Bash

Similar to other programming languages which allow to include other files to a file, Bash scripting also allows to include (source) another shell script file to script file.

For example, to include script to current script file use following syntax, where is available in the same directory of the current script.

Include Shell Script in Other Shell Script

For this example, First, I have created file with the following content.

Now create another file, which includes file.

Execute script in a terminal and view the results:


Welcome Test
Your id is 100

Post a Comment