I have two bash scripts: main one and auxiliary.
Let's say main script is:
#!/bin/bash
echo "This is start of my main script"
./auxiliary.sh
echo "This is end of my main script"
and auxiliary one is:
cd some-folder
echo "This is file placed in some-folder by auxiliary script" > file1
cd ..
cd other-folder
echo "This is file placed in other-folder by auxiliary script" > file2
My goal is to execute lines in auxiliary script (or just text file) as if those lines were written directly in main script. So if, for example, I invoke auxiliary.sh from inside a loop or function, all lines of auxiliary.sh will be executed in that loop or function.