Skip to content

Instantly share code, notes, and snippets.

@achiku
Created August 11, 2018 09:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save achiku/f707788695d9ea0a1c31d84d028d447f to your computer and use it in GitHub Desktop.
Save achiku/f707788695d9ea0a1c31d84d028d447f to your computer and use it in GitHub Desktop.
#!/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