Does the simple job of finding any 'source' lines in a BASH script and replacing that line with the full contents of that source.
So you can split your BASH script up into multiple files and then 'compile' it into a single file when you're ready.
> ls
standalone.sh
program.src.sh
include_file.sh
#!/bin/bash
echo "start"
source include_file.sh
echo "finish"
#!/bin/bash
echo "middle"
./standalone.sh --input program.src.sh --output program.sh
The program.sh
will be generated with the same permissions as the source.
#!/bin/bash
echo "start"
#source include_file.sh
echo "middle"
echo "finish"