His may seem simple to many but I have no clue
Need some urgent help please
How can I make this statement evaluate to true if the actual DataFile can have an extension of either .dat or .txt
what I'm trying to say is my datafile could have a name like
ABC_20070323_xyz.dat
or
ABC_20070323_xyz.txt
now the trick is also in the if statement
These for example are now valid
ABC_20070323_xyz.dat.gz
or
ABC_20070323_xyz.dat.Z
or
ABC_20070323_xyz.txt
notice the .txt file can also have the option of no compression
ControlFileName=${ControlFile##*/};
DataFile="${SOURCE_DATA_PATH}/${ControlFileName%.*}.dat";
if [[ -f "${DataFile}" ]]; then
X=1; # Do nothing
elif [[ -f "${DataFile}.gz" ]]; then
DataFile=${DataFile}.gz;
elif [[ -f "${DataFile}.Z" ]]; then
DataFile=${DataFile}.Z;
else
Log ERROR "Could not find data file for Data File=${DataFile} [or .dat.gz or .dat.Z]";
returnStatus=1;
break;
fi;