5

How to list todays and yesterdays .rej files from a directory?

view full story
linux-howto

http://www.unix.com – I am trying to display todays and yesterdays .rej files from a directory. ls -lrt *.rej | grep 'Aug 12' ; ls -lrt *.rej | grep 'Aug 13' Which is working as above. But i want take 'Aug 12' and 'Aug 13' from a variable and the command should work everyday. I am able to get todays files by using belows pseudo code. psuedo code: d=$ `date '+%b %d'` yest=$(`date -d '1 day ago' +'%d %d'`) ls -lrt *.rej | grep 'd' ; ls -lrt *.rej | grep 'yest' but i am facing problem while printing yesterdays date files. Error is date: Not a recognized flag: d Usage: date [-u] [+"Field Descriptors"] (HowTos)