I have a requirement in a shell script. I get this location information from a text file; it is always valid.
/opt/sasuapps/senny/publish/gbl/SANDHYA/drop1
I need to check if the directory is empty or not which I have done. If the directory is not empty, I need to delete the files and directory under that location.
As a part of security check, I would like to check if the drop location got from the file (/opt/sasuapps/senny/publish/gbl/SANDHYA/drop1) starts with any of the below.
/mnt/senny_publish/gbl
/mnt/senny/publish/gbl
/opt/sasuapps/senny/publish/gbl
If yes then only go ahead and delete; else don't do anything.
How can I compare the location given with those fixed strings?