In the Korn Shell, how do I check if a filename contains a prefix ?<br>
eg.<br>
for file in /usr/files/*<br>
do<br>
# check if filename contains a ".gz"<br>
if ( grep ".gz" ${file} )<br>
then<br>
echo "file is zipped"<br>
else<br>
echo "file is not zipped"<br>
fi<br>
done<br>
<br>
The problem is that $file gets interpreted as the file content and I need it interpreted as the file name only ?<br>
<br>
Thanks<br>
Steve
eg.<br>
for file in /usr/files/*<br>
do<br>
# check if filename contains a ".gz"<br>
if ( grep ".gz" ${file} )<br>
then<br>
echo "file is zipped"<br>
else<br>
echo "file is not zipped"<br>
fi<br>
done<br>
<br>
The problem is that $file gets interpreted as the file content and I need it interpreted as the file name only ?<br>
<br>
Thanks<br>
Steve