Hi all,
I am facing another issue with this find.....
Here is my program
#!/bin/sh
# Environmental set up
envSet="true";
# Initialize error code
error_code="false";
if [ "$envSet" = "$2" ]
then
# Set batch environment
. $1/jobs/setBatchEnv.sh $1
fi
echo "file name ---------"$filename
echo "BATCH_HOME ---------"$BATCH_HOME
echo "3 ---------"$3
#Frame the output file name
if [ "$filename" != "" ]
then
echo "Inside IF"
#if ZipReports.sh executed, then the filename of the zip will be taken from that
outfilename = $filename;
else
echo "Inside ELSE"
#if ZipReports.sh not executed, then the filename will be the list of files that are last modified today
cd $BATCH_HOME/data/output/$3
pwd
outfilename=$(find . -type f -mtime 0 | tr '\n' ',');
fi
echo "outifle-------"$outfilename
# Call the EmailReportsBatch.java program
$JAVA_HOME/java -Xmx1024m -Djava.awt.headless=true \
-DPROPERTIES_PATH=$BATCH_HOME/properties \
-DREPORT_TYPE=$3 \
-DOUTPUT_PATH=$BATCH_HOME/data/output/$3/ \
-DOUTPUT_FILE=$outfilename \
batch.EmailReportsBatch > $LOG_DIR/EmailReportsBatch.log
# Check if java command fails
if test ! $? -eq 0
then
error_code="true";
fi
When i execute this pgm i am getting the outfilename value correctly. But when it is invoked from main shell this outfilename is giving me one value less than what it is supposed to give. That is if 3 files are modified today, it is giving only 2 file names. Any suggestion why this is happening?
But when BATCH_HOME, $3 values are echoed they show the same results...
Thanks,
Ananthi.U