How to get the day of week with bash/sh
May 19, 2011
1 minute read

How to get the day of week with bash/sh

  • Localized day of week :
#!/bin/sh
DOW=$(date +"%a")
echo $DOW
  • In english :
#!/bin/sh
LANG=C DOW=$(date +"%a")
echo $DOW

If you want to get current month, year, … replace %a by anything found here



comments powered by Disqus