#! /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