aboutsummaryrefslogtreecommitdiff
path: root/fix-dotfile-paths.sh
diff options
context:
space:
mode:
authorJacob Janzen <jjanzenn@proton.me>2024-08-08 20:04:28 -0500
committerJacob Janzen <jjanzenn@proton.me>2024-08-08 20:04:28 -0500
commitd9ce5332998ac540c8b2fda4c82a071f81eec834 (patch)
treee53fdc00b778031b5a6b6760e648613dc32eb526 /fix-dotfile-paths.sh
parentdc19c7ae8dc2103a7c06cd2dfc473382ce79e224 (diff)
more bug fixes
Diffstat (limited to 'fix-dotfile-paths.sh')
-rwxr-xr-xfix-dotfile-paths.sh9
1 files changed, 5 insertions, 4 deletions
diff --git a/fix-dotfile-paths.sh b/fix-dotfile-paths.sh
index c6d6827..aa0197d 100755
--- a/fix-dotfile-paths.sh
+++ b/fix-dotfile-paths.sh
@@ -18,12 +18,13 @@ create_ls_entry () {
continue
fi
- if echo "${file}" | grep -q "\.org\$"; then
+ if echo "${file}" | grep -q "\.org$"; then
new_file=$(basename "$(grep '#+begin_src' "${file}" | head -1 | cut -d ' ' -f 4)")
else
new_file=$file
fi
- echo "- [[https://jjanzen.ca/dotfiles/$1/${file}][${new_file}]]" >> index.org
+ html=$(echo "${file}" | sed 's/\.org\$/\.html/')
+ echo "- [[https://jjanzen.ca/dotfiles/$1/${html}][${new_file}]]" >> index.org
fi
done
}
@@ -32,10 +33,10 @@ cd ~/.dotfiles || exit
START=$(pwd)
# iterate over all files except the .git/ directory and .
-find -- . -type d | sed '/^\.\$/d' | sed '/^\.\/\.git\//d' | sed '/^\.\/.git/d' | while read -r dir; do
+find -- . -type d | sed '/^\.$/d' | sed '/^\.\/\.git\//d' | sed '/^\.\/.git/d' | while read -r dir; do
cd "${dir}" || continue
- line=$(echo "${line}" | sed 's/^\.\///')
+ dir=$(echo "${dir}" | sed 's/^\.\///')
create_ls_entry "${dir}"