Created
January 6, 2012 18:12
-
-
Save ods94065/1571724 to your computer and use it in GitHub Desktop.
Engrave document with LilyPond using BBEdit/TextWrangler on Mac OS X
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 | |
# This script runs LilyPond on the currently open document in BBEdit/TextWrangler. | |
# It assumes you have already saved your work. | |
# Change this path, and these options, to suit your installation and preferences. | |
LILYAPP=/Applications/LilyPond.app/Contents/Resources/bin/lilypond | |
LILYOPTIONS= | |
# BBEdit/TextWrangler pass the pathname to the currently open document | |
# through BB_DOC_PATH. | |
SRC_LY="$(basename "$BB_DOC_PATH")" | |
if [ -z "$SRC_LY" ]; then | |
echo "ERROR: there is no document on disk to engrave!" | |
echo "If you are working on a new document, save your document and rerun this script." | |
exit 1 | |
fi | |
SRC_ROOT="${SRC_LY%.ly}" | |
SRC_PDF="${SRC_ROOT}.pdf" | |
SRC_DIR="$(dirname "$BB_DOC_PATH")" | |
cd "$SRC_DIR" && "$LILYAPP" $LILYOPTIONS -o "$SRC_ROOT" "$SRC_LY" && open "$SRC_PDF" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment