Q:

Shell Script for Yesterdays Date

I have tried adding -d "yesterday" but I haven't had any luck getting it to work.   Here is what I have for the whole script:
#!  /bin/bash

saveDir="TJ"
dd=$(date +"%m-%d-%Y")
for file in *.csv ; do
    saveName="${saveDir}/TJ ${dd}.csv"
    cut -d',' -f2,14 "$file" > "$saveName"
done

how do I get dd to output yesterdays date instead of the current date? 
EDIT: This is what I have now
#!  /bin/bash

saveDir="TJ"
dd=$(date --date='yesterday' +'%m-%d-%Y')
for file in *.csv ; do
    saveName="${saveDir}/TJ ${dd}.csv"
    cut -d',' -f2,14 "$file" > "$saveName"
done

the above is saving the file as TJ .csv but I'm not sure what was done incorrectly

A:

I think you want to use -
$ cat test.sh
#! /bin/bash

dd=$(date --date='yesterday' +'%m-%d-%Y')
echo $dd
$ ./test.sh
12-31-2013

or you could use
$ date -d '1 day ago' +'%m-%d-%Y'
12/31/2013

And for tomorrow -
$ date -d '1 day' +'%m-%d-%Y'
01/02/2014

or
$ date --date='tomorrow'
Thu Jan  2 21:25:00 EST 2014

