SoFunction
Updated on 2025-03-10

Three methods in the shell to call, reference, and contain another script file

Script first (test example 1)
first
#!/bin/bash
echo 'your are in first file'

Method 1: Use source

#!/bin/bash
echo 'your are in second file'
source first

Method 2: Use.

#!/bin/bash
echo 'your are in second file'
. first

Method 3: Use sh
#!/bin/bash
echo 'your are in second file'
sh  first