I'm trying to execute the following shellscript with hazel app on any file in the folder. It works, but the only thing thats causing a problem is the date for yesterday.
#! /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
Any ideas why it isn't working?
Best Answer
Try using date like this:
as mentioned
yesterday
is part of GNU Date, but using an offset of -1d should be equivalent for OS X use.