aboutsummaryrefslogtreecommitdiff
path: root/fix-dotfile-paths.sh
diff options
context:
space:
mode:
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}"