PDA

View Full Version : [ubuntu] date in shell script, this format 0720108


dapim
July 20th, 2008, 09:51 PM
i would like to retrive date in shell script,
in this format 0720108 , month day and year, how can i do that?

sisco311
July 20th, 2008, 09:53 PM
???
date +%m%d%y???

ghostdog74
July 20th, 2008, 09:54 PM
check the date man page

date +%d%m #this is for day and month.

iaculallad
July 20th, 2008, 10:04 PM
That would be:

#!/bin/bash
echo "`date +%m%d%y`"
exit 0

Dr Small
July 20th, 2008, 10:12 PM
That would be:
Or:
#!/bin/bash
date=`date +%m%d%y`
echo $date
exit 0