12-13-2012, 11:05 AM
|
#3
|
LQ Guru
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
|
You'd need to provide more detail.
Are you writing a script that creates the file and checking to see if it in fact created it or are you just looking to see if a file exists.
If the latter you don't need a script. If you know the location you can use ls and if you don't you can use find:
e.g.
If you're looking for a file named billybob and it is should be in /usr/local/bin you can do "ls /usr/local/bin/billybob". If it is there it will show the file - if not it will say "not found".
If you don't know where it is you can do "find / -name billybob" and it will find any file of that name.
Note that find is context switch heavy so if you can narrow it down (e.g. if you know it should be somewhere under /usr but not sure exactly where) you should do so:
"find /usr -name billybob"
|
|
|