Skip to content

Instantly share code, notes, and snippets.

@TaurusOlson
Created August 25, 2011 11:20
Show Gist options
  • Save TaurusOlson/1170458 to your computer and use it in GitHub Desktop.
Save TaurusOlson/1170458 to your computer and use it in GitHub Desktop.
Display the date in various formats
#!/bin/bash
[[ $1 -eq -1 ]] && today=`date +%m/%d/%y` && echo $today
[[ $1 -eq -2 ]] && today=`date +%m-%d-%y` && echo $today
[[ $1 -eq -3 ]] && today=`date +%d/%m/%y` && echo $today
[[ $1 -eq -4 ]] && today=`date +%d-%m-%y` && echo $today
[ $# -ne 1 ] &&
cat <<-EOF
Usage: today OPTION
Availabe OPTIONs:
-1: m/d/y
-2: m-d-y
-3: d/m/y
-4: d-m-y
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment