Skip to content

Create a BASH standalone file by replacing 'source' commands with their file contents

Notifications You must be signed in to change notification settings

IORoot/standalone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Standalone

Does the simple job of finding any 'source' lines in a BASH script and replacing that line with the full contents of that source.

Why

So you can split your BASH script up into multiple files and then 'compile' it into a single file when you're ready.

Example

> ls
standalone.sh
program.src.sh
include_file.sh

input: program.src.sh

#!/bin/bash

echo "start"

source include_file.sh

echo "finish"

include_file.sh

#!/bin/bash

echo "middle"

Run command

./standalone.sh --input program.src.sh --output program.sh

The program.sh will be generated with the same permissions as the source.

output: program.sh

#!/bin/bash

echo "start"

#source include_file.sh
echo "middle"

echo "finish"

About

Create a BASH standalone file by replacing 'source' commands with their file contents

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages