Variables now working in Sed

This commit is contained in:
Scott C. MacCallum 2023-02-25 00:41:03 +00:00
parent 62f6e32736
commit d7514e27c4

View File

@ -15,14 +15,13 @@ wget -O /sdf/arpa/ns/s/scm/index.html https://scm.sdf.org
wget -O /sdf/arpa/ns/s/scm/$month.html https://scm.sdf.org/posts/$year/$month.html
# Remove the post related lines from the index HTML file
# Remove the posts header line from the index HTML file
sed -i 's/<h3>Posts<\/h3>//' /sdf/arpa/ns/s/scm/index.html
# This line works as it is but ideally the year and month would use
# variables. I don't know how to this yet and will move forward.
# Remove the posts lines from the index HTML file
sed -i 's/<h4><a href="https\:\/\/scm.sdf.org\/posts\/2023\/02.html">2023<\/a><\/h4>//' /sdf/arpa/ns/s/scm/index.html
sed -i "s/<h4><a href="https\:\/\/scm.sdf.org\/posts\/{$year}\/{$month}.html">{$year}<\/a><\/h4>//" /sdf/arpa/ns/s/scm/index.html
# Convert the index HTML file to an index text file
@ -55,14 +54,10 @@ cat /sdf/arpa/ns/s/scm/footer | col -b -x > /sdf/arpa/ns/s/scm/footer.sdf
# Write the posts text file to the .plan cluster text file
# Change the head number as needed when the index.html file is changed
head -n 10 index.sdf > /sdf/arpa/ns/s/scm/header
head -n 5 index.sdf > /sdf/arpa/ns/s/scm/header
cat /sdf/arpa/ns/s/scm/$month.sdf > body
cat /sdf/arpa/ns/s/scm/header > /sdf/arpa/ns/s/scm/.plan
cat /sdf/arpa/ns/s/scm/body >> /sdf/arpa/ns/s/scm/.plan
cat /sdf/arpa/ns/s/scm/footer.sdf >> /sdf/arpa/ns/s/scm/.plan
# Write the index text file to the root directory of Gopher
@ -83,7 +78,9 @@ chmod -R 754 /ftp/pub/users/scm
scp /sdf/arpa/ns/s/scm/.plan scm@ma.sdf.org:/meta/s/scm
scp /sdf/arpa/ns/s/scm/index.sdf scm@ma.sdf.org:/meta/gemini/scm/index.gmi
scp /sdf/arpa/ns/s/scm/header scm@ma.sdf.org:/meta/gemini/scm/index.gmi
cat /sdf/arpa/ns/s/scm/body | ssh scm@ma.sdf.org "cat >> /meta/gemini/scm/index.gmi"
scp /sdf/arpa/ns/s/scm/$month.sdf scm@ma.sdf.org:/meta/gemini/scm/posts/$year/$month.gmi