here's the script i ran every time i had to update my notes:
ls /usr/local/apache2/htdocs/linus/notes/ > /usr/local/apache2/htdocs/linus/notes/x
cp /usr/local/apache2/htdocs/linus/notes/x /usr/local/apache2/htdocs/linus/notes/y
cp /usr/local/apache2/htdocs/linus/notes/x /usr/local/apache2/htdocs/linus/notes/z
# used ^ cuz problematic when using perl %s $ in script
perl -e 's/^/<a href="/g' -p -i /usr/local/apache2/htdocs/linus/notes/x
perl -e 's/^/">/g' -p -i /usr/local/apache2/htdocs/linus/notes/y
perl -e 's/^/<\/a>/g' -p -i /usr/local/apache2/htdocs/linus/notes/z
paste /usr/local/apache2/htdocs/linus/notes/x /usr/local/apache2/htdocs/linus/notes/y /usr/local/apache2/htdocs/linus/notes/z > /usr/local/apache2/htdocs/linus/notes/index.html
rm -rf /usr/local/apache2/htdocs/linus/notes/x
rm -rf /usr/local/apache2/htdocs/linus/notes/y
rm -rf /usr/local/apache2/htdocs/linus/notes/z
chown -Rf nobody:root /usr/local/apache2/htdocs/linus/notes
chmod -Rf 755 /usr/local/apache2/htdocs/linus/note
saved it as xCreateIndex.sh. you can even see the script file in the image in the link above. crazy, huh?
No comments:
Post a Comment