diff options
Diffstat (limited to 'trunk/common-titles.sh')
-rw-r--r-- | trunk/common-titles.sh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/trunk/common-titles.sh b/trunk/common-titles.sh new file mode 100644 index 0000000..9bc0de8 --- /dev/null +++ b/trunk/common-titles.sh | |||
@@ -0,0 +1,21 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | outFile="$1"; | ||
4 | header="$2"; | ||
5 | shift 2; | ||
6 | glob="$@"; | ||
7 | |||
8 | echo -n "Compiling ${outFile}..."; | ||
9 | cat "$header" > $outFile; | ||
10 | |||
11 | for file in $glob; do | ||
12 | # Copy title to $outFile & link | ||
13 | title="$(grep '^title:' "$file" | cut -d' ' -f2- | sed 's/"//g')"; | ||
14 | if (( $RANDOM % 13 == 0 )); then | ||
15 | echo -n "| "; | ||
16 | else | ||
17 | echo -n " "; | ||
18 | fi | ||
19 | echo "[$title](${file%.*}.html)" >> "$outFile"; | ||
20 | done | ||
21 | echo "Done."; | ||