file_to_log (version 1.0)
You can also look at:
#! /usr/bin/perl
##############################################################################
#
# SYNTAX: file_to_log filename
#
# DESCRIPTION: This utility copies a file to the job log.
#
# VERSION: 1.0
#
# HISTORY: 0.0 -> 1.0 1999-05-07
# HISTORY: Converted from ksh to perl
#
# CALLS: $UTIL/generate_filename
#
##############################################################################
use File::Basename;
$file = $ARGV[0];
$UTIL = $ENV{"UTIL"};
$DEBUG = $ENV{"DEBUG"};
$scriptname = basename($0);
###########################################################
# Get the name of the job log and check for errors by hand
###########################################################
chomp($joblog = `$UTIL/generate_filename joblog`);
###################
# Debugging output
###################
if ( "$DEBUG" ) {
print "$scriptname: file=$file\n"
}
################################
# Append the file to the joblog
################################
if ( "$file" and -r $file ) {
open JOBLOG, ">>$joblog";
open FILE, "<$file";
print JOBLOG "<PRE>\n";
while ( <FILE> ) {
print JOBLOG;
}
print JOBLOG "</PRE>\n";
}
exit 0;