about summary refs log tree commit diff stats
path: root/trunk/common-titles.sh
blob: bae8a10434cdd5b648bf3a093ec3b4ff03c8a8b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash

outFile="$1";
shift 1;
glob="$@";

echo -n "Compiling ${outFile}";

for file in $glob; do
    # Copy title to $outFile & link
    title="$(grep '^title:' "$file" | cut -d' ' -f2- | sed 's/"//g')";
    if (( $RANDOM % 13 == 0 )); then
        echo -n "| " >> "$outFile";
    else
        echo -n "  " >> "$outFile";
    fi
    echo "[$title](${file%.*}.html)" >> "$outFile";
    echo -n ".";
done
echo "Done.";