about summary refs log tree commit diff stats
path: root/trunk/backlink.sh
diff options
context:
space:
mode:
Diffstat (limited to 'trunk/backlink.sh')
-rw-r--r--trunk/backlink.sh38
1 files changed, 0 insertions, 38 deletions
diff --git a/trunk/backlink.sh b/trunk/backlink.sh deleted file mode 100644 index f6feb7d..0000000 --- a/trunk/backlink.sh +++ /dev/null
@@ -1,38 +0,0 @@
1#!/bin/bash
2
3# Command-line variables
4searchQuery="$1"; # .html file to backlink
5outFile="$2"; # .back file to create
6headerFile="$3"; # header information file
7shift 3;
8glob="$@"; # where to search for backlinks
9
10# Find backlinkers
11echo -n "Back-linking \"$searchQuery\""
12cat "$headerFile" > "$outFile";
13if ! grep -ql "$searchQuery" $glob >> "$outFile"; then
14 echo "[_island_](${islandLink}.htm)." >> "$outFile";
15 title=`grep '^title:' "${searchQuery%.html}.txt" | cut -d' ' -f2-`;
16 echo "- [$title]($searchQuery)" >> "${islandLink}.txt"
17fi
18
19# Change title & id of $outFile
20inText="`basename $searchQuery .html`.txt";
21title=`grep '^title:' "$inText" | cut -d' ' -f2-`;
22id=`grep '^id:' "${searchQuery%.html}.txt" | cut -d' ' -f2`;
23sed -i "s/_TITLE_/$title/" "$outFile";
24sed -i "s/_ID_/$id/" "$outFile";
25echo -n "."
26
27# Change *.txt to *.html
28sed -i 's/^\(.*\)\.txt/\1.html/g' "$outFile";
29
30# Link to backlinks
31for file in `grep '.html$' "$outFile"`; do
32 fText="`basename $file .html`.txt";
33 title=`grep '^title:' $fText | cut -d' ' -f2-`;
34 sed -i "s/^$file$/- [$title](&)/" "$outFile";
35 echo -n "."
36done
37
38echo "Done."