[nflug] bash scripting

Tony E - Jaraeth jaraeth at phoenixwing.com
Sat Aug 25 13:15:50 EDT 2007


For archiving files, as an example, I usually us something like:

  mv filename.tgz filename.`date +%Y%m%d`.tgz

Hope that helps,

~ Tony E



Robert Stockdale IV wrote:
> Hi All:
> I'm a bit rusty at scripting. I've only done a little in the past. What
> I am trying to do is create a file name with the date as part of the
> name. Such as tnt082507.pdf (tnt'mmddyy'.pdf). I did this about 20 years
> ago in MS-DOS. I'm planning to setup a cron job to retrieve a file from
> the web using wget. The file always has the same name and I don't want
> to overwrite the previous days file. I'd like to save them in a dated
> filename with a mv command in a specified directory. How can I
> concatenate the system date as specified to create unique filenames for
> each days file?
> Thank you.
> Bob
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> nflug mailing list
> nflug at nflug.org
> http://www.nflug.org/mailman/listinfo/nflug


More information about the nflug mailing list