You are not logged in.
I'm trying to make a script to run markdown on all the *.md files in a directory and make a bunch of *.html files with the same name before the extension. I've looked at some bulk renaming scripts, but I don't really want to copy or move anything. I just want to send the output of markdown to a new file. How can I do this?
#!/bin/sh
# run markdown on each md file; output a file with same name
# but .html extension.
make()
{
NOTES="*.md"
for note in $NOTES
do
# TODO: how to substitute extensions?
markdown $note > # $note but with .html instead of markdown
done
}
# clean out all the html files
clean()
{
rm *.html
}
case $1 in
make)
make
;;
clean)
clean
;;
*)
echo "usage: webify [make|clean]"
;;
esac
Last edited by kandrews (2009-09-08 03:04:55)
Offline
markdown $note > $(basename $note .md).html
Offline
thanks a bunch!
Offline