On Wed, 13 Sep 2000, George Lenzer wrote:
> I've been using Linux for about three years now and haven't really explored much
>beyond the usual bash commands:
> mv, ls, mkdir, export, gzip, dd, cat, etc...
>
> I really want to gain more knowledge on shell scripting. (I used to be pretty good
>at DOS batch files in my "bad old days" :) ) Does anyone have any good resources
>that they are familiar with on the net?
>
> Second question: How would I take the output of the 'date' command and use it to
>name a file? I am going to be setting up a backup routine using tar/gzip and would
>like to name the files with date info. Would I create an environment variable that
>woudl hold the output of 'date' and the tell tar to name the file <evn var>.tar ?
speaking as one who has written a shell programming course, this is
exactly what i give out as an exercise.
note that the "date" command has a bunch of neat output options,
which will include any combination of month, date, hour, minute,
second and so forth:
$ date
$ date +%H
$ date +%M
$ date +%S
$ date +%H:%M:%S
$ date +%T (short form of the above)
and lots of others, check it out. so name a temporary file something
like
FILE=prefix.$(date +%T).$$
where $$ is replaced by the current process ID. that pretty much
guarantees you a unique file name. customize to taste.
rday
--
"This is Microsoft technical support. How may I misinform you?"
_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list