Looking for a better way to do this

I have a script that is searching for a file with todays date as part of the file name.

This works great with a 2 digit day but here is the problem. Those first 9 days of the month .

ls -l MMDVM_Bridge-"$(date -d "0 day" "+%Y-%m-%-d")".log 
ls: cannot access 'MMDVM_Bridge-2019-01-1.log': No such file or directory

it exists as 2019-01-01

root@442400Spotsy-pi:/var/log/dvswitch# ls -l MMDVM_Bridge-2019*                             
-rw-r--r-- 1 root root 358 Jan  1 09:12 MMDVM_Bridge-2019-01-01.log 

Any thoughts ?

Mike

date -d "0 day" "+%Y-%m-%-d"

should be

date -d "0 day" "+%Y-%m-%d"
1 Like

So damn simple, Augh... Thank you

Sometimes 4 eyes help :wink:

1 Like