Created
August 11, 2018 09:24
-
-
Save achiku/f707788695d9ea0a1c31d84d028d447f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for fname in $( ls | grep -v 'a.sh' ); do | |
dt=$( echo ${fname} | sed -E 's/([0-9]{4}-[0-9]{2}-[0-9]{2})-.*/\1/' ) | |
sdt=$( echo ${dt} | sed -E 's/-/\//g') | |
title=$( echo ${fname} | sed -E "s/${dt}-//" ) | |
newurl="/post/${fname%%.md}/" | |
oldurl="/${sdt}/${title%%.md}.html" | |
cat <<-EOF | |
aliases: | |
- ${newurl} | |
- ${oldurl} | |
EOF | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment