Here's what I have so far related to the Mage build tool.
[mgear/mgear.git] / experiments / sip
1 #!/bin/bash
2 # Simple include processor as an example of a dependency-logging command.
3 # sip input output depoutput
4 # Follows `include foo' at the beginning of a line.
5
6 exec 3>"$3"
7 exec >"$2"
8
9 function do_read {
10         echo "$1" >&3
11         while IFS='' read line; do
12                 if [[ "$line" == "include "* ]]; then
13                         do_read "${line#include }"
14                 else
15                         echo "$line"
16                 fi
17         done <"$1"
18 }
19
20 do_read "$1"