Timothy,
    You can set variables in your script to store the date information, like
this (sort of)
YR="2003"
MO="1"

Now your filename becomes "serverlog${MO}${YR}" in your script,

You can put the result of commands into variables in your script like
YR=`date`  (those backticks make the shell see date as a command to run)

Google for bash tutorial or bash script howto

/B

----- Original Message -----
From: "Stone, Timothy" <[EMAIL PROTECTED]>
To: "Redhat-List (E-mail)" <[EMAIL PROTECTED]>
Sent: Monday, December 30, 2002 12:52
Subject: scripting newbie has question...


> Always lurking. Love this list and have learn ed a lot. ;)
>
> I have simple script that works but I would like to make it a bit more
robust and have no idea where to begin as I'm a newbie to shell scripting.
>
> Here's the simplicity of it today:
>
> # start ################################
>
> #!/bin/sh
>
> scp -i [key] [server0-log] [local0-log]
> scp -i [key] [server1-log] [local1-log]
>
> # end ##################################
>
> This is run as a user cron job daily.
>
> The script is going to work for at least another day. Then I will have to
edit it and it will work for another month.
>
> My server logs are named dynamically as so:  %Y%M_server0.log
>
> So the point of all this? How do I add %Y%M features to my script? I don't
know C, but decent with Java, so the bridge is not to far to cross. I might
be over thinking this and the feature is in the shell.
>
> Thanks in advance for any help.
>
> Warmest Regards,
> Tim
>
> --
> /**
>  * Timothy Stone      . Sun Certified Java Programmer
>  * Web Master         . tstone at cityofhbg dot com
>  * City of Harrisburg . 717.255.7297
>  * Pennsylvania USA   . 717.903.9162
>  *
>  * "Censorship always defeats its own purpose,
>  *  for it creates in the end the kind of society
>  *  that is incapable of exercising real discretion."
>  *  --Henry Steele Commager, Historian
>  */
>
>
>
> --
> redhat-list mailing list
> unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
> https://listman.redhat.com/mailman/listinfo/redhat-list



-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to