Search code examples
bashdatebsd

Bash date case not correct


I am using the following in a bash script

echo $(date +'%Y/%b')

I expect "2018/may" but what I actually get is "2018/May". Is there anything I can do to make sure the month is lowercase? I am running in a BSD jail.


Solution

  • As man date does not show help about lowercase month, I would just pipe it

    echo $(date +'%Y/%b') | tr '[:upper:]' '[:lower:]'