I'm pretty new to bash scripting. I want a script that I can run in a directory that contains
.md files, runs pandoc on them, and delivers the output to a sibling folder
html, i.e. my folder structure is like this:
. ├── html └── md
Here is what I have working, I just don't know if I'm following good practices or if there's a nicer / more readable way of doing what I'm doing.
#! /bin/bash # run this from a folder containing markdown files # it delivers html to the sibling html folder if hash pandoc 2>/dev/null; then for file in ./*.md ; do echo Converting $file cat "$file" | pandoc -o "$(echo $file | sed 's/^./..\/html/' | sed 's/.md$/.html/')" done else echo "I need pandoc installed" fi