Created
December 27, 2012 17:14
-
-
Save anonymous/4390013 to your computer and use it in GitHub Desktop.
conditional bash script that takes one argument and checks for an existing executable
This file contains hidden or 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
#!/usr/bin/env bash | |
export PATH="$PATH:/usr/texbin/" | |
which pandoc &>/dev/null | |
if [ $? -eq 0 ] | |
then | |
if [ ! -n "$1" ] | |
then | |
echo 'defaulting to pdf' | |
file_name='scalingphp.pdf' | |
else | |
file_name="scalingphp.$1" | |
fi | |
files=$(ls *.md | grep -vi sample | grep -v README | sort | xargs) | |
pandoc $files -o $file_name | |
else | |
echo "you need to install pandoc" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment