Summary Files Commits Branches @commit @diff @stats
path: root / generate-hooks / make-titles.sh
blob: 4bb70b9c8e305cef8612ae6fe5999fcb11007839 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/bash

if [ -z "$1" ]; then
	echo First parameter must be string with file paths
	exit
fi

awkloc="$(dirname "$0")/create-title.awk"

# Loop through all HTML files in given directory
for file in $1; do
	title=$(awk -f "$awkloc" $file)

	# Replace all "[TITLE]" text in current file with title
	sed -i "s/\[TITLE\]/$title/g" $file
done