I have two variables: X and Y.
The value of X will be a date given in the format mmddyy and I want to calculate the date preceding that date
I like Tcl for date arithmetic, even though it's clunky for shell one-liners. Using Tcl 8.5:
x=091509 y=$(printf 'puts [clock format [clock add [clock scan "%s" -format "%%m%%d%%y"] -1 day] -format "%%Y%%m%%d"]' "$x" | tclsh)