Skip to content

Instantly share code, notes, and snippets.

@Wabri
Created July 14, 2020 07:06
Show Gist options
  • Save Wabri/5f850fd0fd5e1649e4e2da9c10e58434 to your computer and use it in GitHub Desktop.
Save Wabri/5f850fd0fd5e1649e4e2da9c10e58434 to your computer and use it in GitHub Desktop.
One compiler to rule them all
#! /usr/bin/env bash
file=$(readlink -f "$1")
dir=$(dirname "$file")
base="${file%.*}"
cd "$dir" || exit
case "$file" in
*\.tex) pandoc "$file" -f latex -s -o "$base".pdf ;;
*\.md) pandoc "$file" -f markdown -s -o "$base".pdf ;;
*\.py) python "$file" ;;
*\.c) clang $file ;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment