Last active
September 12, 2019 12:24
-
-
Save p410n3/8b81590035a682b2b173020aa42dc824 to your computer and use it in GitHub Desktop.
Small script that uses pandoc and dmenu to comfortably convert .md to .pdf
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 | |
# First arg is the folder | |
_folder=$1 | |
# If _folder is empty, use pwd as default | |
if [[ -z $_folder ]]; then | |
_folder=`pwd`; | |
fi | |
# Open the dmenu with all md files | |
_filename=`ls $_folder | grep '^.*\.md$' | dmenu -l 10` | |
# When dmenu is aborted, it will be empty, exit in that case | |
if [[ -z $_filename ]]; then | |
echo 'Aborted from dmenu' | |
exit 0; | |
fi | |
# Now convert it to pdf and drop in . | |
pandoc $_folder$_filename -o "${_filename}.pdf" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment