Finding a file in /etc folder

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Finding a file in /etc folder

Bidyut Saha
How to test whether a file is in /etc folder or not?
Reply | Threaded
Open this post in threaded view
|

Re: Finding a file in /etc folder

Guru
Administrator
What did you try?
Reply | Threaded
Open this post in threaded view
|

Re: Finding a file in /etc folder

bayok
In reply to this post by Bidyut Saha
- from bash you can try:

ls -la /etc/file-name
or
ls -la /etc/*partial-file-name*
or
find /etc -iname file-name

- inside script code:

filename=$FILENAME
if [ -f /etc/$FILENAME ]; then
   echo "file found"
else
   echo "file not found"
fi