title: Bash: if vs. case
body: <p>Below I use <code>if</code> statements and <code>case</code> statements to arrange the order of my arguments below to ease the repetitive typing I do with rsync. Would a <code>case</code> statement be wiser for the <code>if</code> blocks below? If so, how?</p>
  
  <pre><code>#!/bin/bash
  
  rsync="rsync -vrtzhP --delete"
  localmus=" /cygdrive/c/Users/user/Music/Zune/"
  remotemus=" 10.252.252.254::Zune/"
  localcal=" /cygdrive/c/Users/user/calibre/"
  remotecal=" 10.252.252.254::calibre/"
  dry=" -n"
  
  if [ $1 == "zune" ] &amp;&amp; [ $2 == "tohere" ]
  then
      toex=$rsync$remotemus$localmus
  fi
  
  if [ $1 == "zune" ] &amp;&amp; [ $2 == "tothere" ]
  then
      toex=$rsync$localmus$remotemus
  fi
  
  if [ $1 == "calibre" ] &amp;&amp; [ $2 == "tohere" ]
  then
      toex=$rsync$remotecal$localcal
  fi
  
  if [ $1 == "calibre" ] &amp;&amp; [ $2 == "tothere" ]
  then
      toex=$rsync$localcal$remotecal
  fi
  
  
  if [[ $3 == "dry" ]]
  then
      toex=$toex$dry
  fi
  
  echo
  echo $toex
  echo
  echo "Execute? y/n: "
  read answer
  case $answer in
      y)
          eval $toex
      ;;
      n)  
          echo NO!
      ;;
  esac
  </code></pre>