include.sh | Powerful File Inclusion for Bash
Why use include.sh?
Powerful features packed into a single shell script.
File Inclusion
Replace ~>> filename with actual content instantly.
Recursive
Include files that include other files. Deeply nested templates made easy.
Flexible Output
Stream directly to stdout or specify a target file as a second argument.
Safe Handling
Robust error messages when files are missing to ensure your build doesn't fail silently.
See it in action
Imagine you have a world.txt containing "World"<br>and a hello.txt using the tag system.<br>Running the script merges them perfectly.
Simple syntax: ~>> file
Supports standard piping and redirection
Zero dependencies besides standard Unix tools
bash — 80x24
# Input: hello.txt
Hello ~>> world.txt
# Input: world.txt
World
❯ ./include.sh hello.txt
Hello World!
❯ ./include.sh hello.txt > output.txt
# Output saved to output.txt via redirection
❯ ./include.sh hello.txt output.txt
# Output saved directly to output.txt
Requirements
Bash
sed
cat
tr
head
Installation
Step 1
# Download the script
curl -L https://include-sh.codeberg.page/include.sh -o include.sh
Step 2
# Make executable
chmod +x include.sh
Step 3
# Move to PATH and rename
sudo cp include.sh /usr/local/bin/include<br>sudo chmod +x /usr/local/bin/include
Ready to go!
Now that it's installed, you can run the include command from anywhere in your terminal.
❯ include hello.txt
❯ include hello.txt > output.txt
❯ include hello.txt output.txt