From 1d80a84dc80b1ada279c8c30db5efe92f06a7087 Mon Sep 17 00:00:00 2001 From: Nick Dumas Date: Tue, 28 Feb 2023 11:03:52 -0500 Subject: [PATCH] Finally working --- drone-plugins/sanitize-links/sanitize-links | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drone-plugins/sanitize-links/sanitize-links b/drone-plugins/sanitize-links/sanitize-links index b4cdec7..1ddd818 100755 --- a/drone-plugins/sanitize-links/sanitize-links +++ b/drone-plugins/sanitize-links/sanitize-links @@ -1,10 +1,5 @@ #! /bin/sh -for noteDir in "$1/notes/*"; do - echo "noteDir: $noteDir" - noteName=$(echo $noteDir| cut -d'/' -f3) - notePath="$(echo $noteDir| cut -d'/' -f1-2)/$noteName" - echo "noteName: $noteName" - echo "notePath: $notePath" - sed -i "s#Resources/attachments#notes/$noteName#" $notePath/index.md -done +# Grab the "note name", e.g. `$BLOGDIR/contents/notes/demo-post/` yields 'demo-post' +noteName=$(echo $1|awk -F'/' '{print $(NF-1)}') +sed -i "s#Resources/attachments#notes/$noteName#" $1