Ksh(Unix Distro) script

ok so i am writing in VI.

Basically i am writing a script which does the following

1.) creates a file name as:

`hostname.`date '+%d%m%y_%H%M'.1.html

2.) echos some html tags >> to the same file name
3.) takes info from command showrev -p and then >> to the same file
4.) echos closing html tags and then >> to the same file

The issue is, This is for log keeping purposes, so i want to include the time, so that when the time changes the patch info will be spit into files per data/time for easy referencing. but if the script runs between changes in time i get two halves of the file seperate instead of 1 complete file

work around?

---------- Post updated at 01:29 PM ---------- Previous update was at 12:37 PM ----------

OK i guess im being too vague... lemme type this beast out...

 
#! /bin/ksh
 
 
touch `hostname`.`date '+%d%m%y_%Hhr%Mmin'`.PATCHES.html
 
echo "<html><body><pre width=pahe>" >>`hostname`.`date '+%d%m%y_%Hhr%Mmin'`.PATCHES.html
 
echo "PATCHES" >>`hostname`.`date '+%d%m%y_%Hhr%Mmin'`.PATCHES.html
 
echo "----------" >>`hostname`.`date '+%d%m%y_%Hhr%Mmin'`.PATCHES.html
 
showrev -p >>`hostname`.`date '+%d%m%y_%Hhr%Mmin'`.PATCHES.html
 
echo "</pre></body></html>" >>`hostname`.`date '+%d%m%y_%Hhr%Mmin'`.PATCHES.html

SO my problem again is it makes 2 files during the time change, How can i redirect the info into the file just created. Do i need to set the time of the script running to a variable, then reference the file redirect to the variable? or should i just be lazy and drop the time portion of date all togather.

Work around?

why don't you put date and time in a variable which you then can recall?

Change your script to something like this:

#!/bin/ksh
FILE=`hostname`.`date '+%d%m%y_%Hhr%Mmin'`.PATCHES.html
touch $FILE
echo "<html><body><pre width=pahe>" >>$FILE
echo "PATCHES" >>$FILE
echo "----------" >>$FILE
showrev -p >>$FILE
echo "</pre></body></html>" >>$FILE

tyler_durden

Yeah now that i think about it this is prolly the way to go, The reason i didnt do it that way in the first place was.
1.) i dont know Solaris Variables(create/set)
2.) I wasnt sure if the Variable would stay static or would update with the time as well. It is after all a VARIABLE. but ill test and figure out variables.

i don't know what programming languages you've been using, but AFAIK variables are static until changed by some operation.