title: How do I make shell scripts work on both Linux and OS X?
body: <p>I have a snippet of code to compile a tex document. </p>
  
  <pre><code>#!/usr/bin/env bash
  
  filename="thesis"
  
  pdflatex -shell-escape $filename
  makeglossaries $filename
  bibtex $filename
  pdflatex $filename
  pdflatex $filename
  
  # for Ubuntu
  #xdg-open $filename.pdf
  
  # for mac
  open $filename.pdf
  </code></pre>
  
  <p>How do I make this script work on both Linux and OS X? I think it should be something like,</p>
  
  <pre><code>if is Linux; then
      xdg-open $filename.pdf
  elif is OS X; then
      open $filename.pdf
  fi
  </code></pre>