LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 05-19-2004, 09:10 PM   #1
ultima
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, 03:24 AM   #2
Qucho
Member
 
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.
http://www.freeos.com/guides/lsst/index.html

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

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

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

find directory -iname "file-name" -print

eg.
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

eg.
#myfindscript /etc smb.conf

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

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


Reply


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 06:30 PM
find command jch02140 Linux - Newbie 2 07-19-2005 01:21 AM
The find command Gins Linux - General 32 06-12-2005 03:20 PM
What is the FIND command Mic Q SUSE / openSUSE 1 04-07-2005 10:08 AM
not find mt command imsajjadali Red Hat 2 02-07-2004 07:27 AM


All times are GMT -5. The time now is 08:25 PM.

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