[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Sheflug] shell script challenge



> 
> Cant see why not to use /bin/date with formatting
> instead of putting names into array hardcoded.
> say 
> echo mylist_`date +%d_%B_%H.%M`.txt
> will produce output:
> mylist_24_July_19.57.txt

You could, but you need to take into account the OP asked for last month's
files to go into a directory lastmonth, and the previous months to go into
a directory based on the date of the month they realate to, thus you have
to work out what the month was two months previous to the current.

Btw, I'd actually use +%Y%m%d as the format string, simple as dates in that
format are easily sortable programmatically, as well as being easy for 
humans to read as well :)

Chris...

-- 
\ Chris Johnson           \
 \ cej [at] nightwolf.org.uk    ~-----,   
  \ http://cej.nightwolf.org.uk/  ~-----------------------------------, 
   \ Redclaw chat - http://redclaw.org.uk - telnet redclaw.org.uk 2000 \____
___________________________________________________________________

Sheffield Linux User's Group -
http://www.sheflug.co.uk/mailfaq.html

  GNU the choice of a complete generation.