mainFile=$(find /home/INVENT/custREAD -name '*.txt.gz' -type f -mmin 300)
I m using the above line in my shell script to fetch the file from the location /home/INVENT/custREAD
and put it in the variable mainFile
But when I echo this variable, I see:
/home/INVENT/custREAD/filename.txt
But I want that only the file name to be in the variable, because then I want to unzip this file with
gunzip "$mainFile"
but this is causing an error
gzip : No such file or directory
Can someone please correct where am I going wrong?