Skip to content

Instantly share code, notes, and snippets.

Created December 27, 2012 17:14
Show Gist options
  • Save anonymous/4390013 to your computer and use it in GitHub Desktop.
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
#!/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