title: How do I calculate the previous business day in ksh shell script?
body: <p>What is the most elegant way to calculate the previous business day in shell ksh script ?</p>
  
  <p>What I got until now is :</p>
  
  <pre><code>#!/bin/ksh
  
  set -x
  
  DAY_DIFF=1
  case `date '+%a'` in
  "Sun")
     DAY_DIFF=2
     ;;
  "Mon")
     DAY_DIFF=3
     ;;
  esac
  
  PREV_DT=`perl -e '($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time()-${DAY_DIFF}*24*60*60);printf "%4d%02d%02d",$year+1900,$mon+1,$mday;'`
  
  echo $PREV_DT
  </code></pre>
  
  <p>How do I make the ${DAY_DIFF} variable to be transmitted as value and not as  string ?</p>