I am trying to obtain the file name (not including sub file name), however, I still cannot have the string output.
2 existed files at /tmp, AAA.new and BBB.last
Originally, the output result is needed to be shown as follows,
ex:
SYSTEM NEW LAST
===================
01 AAA BBB
My script was as follows, please kindly review and modify!!
if [ ! ls -t -a $filename/*.new || -a $filename/*.last ]; then
echo "------------NA-------------"
elif [-a $filename\*.new]; then
echo "$SYSTEM\ $filename" | read filename
elif [-a $filename\*.last]; then
echo "$SYSTEM\ $filename" | read filename
fi