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


Published 19th May 2011 // #tips




comments powered by Disqus