Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 05-19-2004, 08:10 PM   #1
LQ Newbie
Registered: May 2004
Location: australia
Posts: 1

Rep: Reputation: 0
Unhappy find command...

I'm quite new to Linux and i need help with writing a script for finding a file. It should only takes 2 arguments, the first is the filename to be search and the second is the directory to start searching from. This is to be done using the find command. Any help would be appreciated. Thanks in advance.
Old 05-20-2004, 02:24 AM   #2
Registered: Mar 2004
Location: Colorado, US
Distribution: Debian "Sarge"
Posts: 228

Rep: Reputation: 30
Here is a totoruial, I have not finished it but so far i find it very useful.

And for your project, I am sure you will find your solutions on it.

Old 05-20-2004, 04:28 AM   #3
Registered: Apr 2004
Location: Malaysia
Distribution: Fedora Core
Posts: 93

Rep: Reputation: 15
hmm, try your luck with...

find directory -iname "file-name" -print

find /etc -iname "smb.conf" -print

i have long not do scripting (since college) but i think u can pass in the arguments something to do with $1 $2

myfindscript file-name directory-name
$1 is for file-name
$2 is for directory-name

<content of myfindscript>
find $2 -iname $1 -print
#if it doesn't work try
#find $2 -iname "$1" -print

#myfindscript /etc smb.conf

i haven tested it though... correct me if i'm wrong

Last edited by linuxzouk; 05-20-2004 at 04:34 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Find/grep command to find matching files, print filename, then print matching content stefanlasiewski Programming 9 06-30-2016 05:30 PM
find command jch02140 Linux - Newbie 2 07-19-2005 12:21 AM
The find command Gins Linux - General 32 06-12-2005 02:20 PM
What is the FIND command Mic Q SUSE / openSUSE 1 04-07-2005 09:08 AM
not find mt command imsajjadali Red Hat 2 02-07-2004 06:27 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:56 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration