Skip to content

Commit bba0211

Browse files
committed
Updated on 2024-08-07
1 parent e87a390 commit bba0211

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ <h3>
4242
Last time this was edited was.
4343
</p>
4444
</body>
45-
</html>
45+
</html>

update_date_and_push.sh

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,14 @@
44
current_date=$(date +"%Y-%m-%d")
55

66
# Update the date in the index.html file
7-
if [[ "$OSTYPE" == "darwin"* ]]; then
8-
# macOS version
9-
sed -i '' '/<p>.*Last time this was edited was.*<\/p>/c\
10-
<p>\
11-
Last time this was edited was '"$current_date"'.\
12-
</p>' index.html
13-
else
14-
# Linux version
15-
sed -i '/<p>.*Last time this was edited was.*<\/p>/c\ <p>\n Last time this was edited was '"$current_date"'.\n </p>' index.html
16-
fi
7+
awk -v date="$current_date" '
8+
/<p>.*Last time this was edited was.*<\/p>/ {
9+
print " <p>"
10+
print " Last time this was edited was " date "."
11+
print " </p>"
12+
next
13+
}
14+
{print}' index.html > temp.html && mv temp.html index.html
1715

1816
# Add all changes to git
1917
git add .

0 commit comments

Comments
 (0)