Need quick help with basic FIND in korn shell

I gotta make a script to find files, not quite sure whats wrong...

filename is search

i run it

search ass* $HOME
ass* is the filename

and in my script i have...

find $2 -name $1 -print

but it never works, anyone know what i gotta fix?

and does anyone know the difference bettwen regular expressions and file expansion char's when it comes to seraching?
i know reg exp is but not expan.
thanks, steve

Here's a possible solution

Using your example
Input: search ass\* $HOME

Script: find $2 -name "$1" -print

Hope it helps.

I still get:
Usage: find Path-List [Expression-List]

I work in digital unix. If you are searching for a wild card it must be in quotes. Your command line mightneed to be:

find $HOME -name "ass*" -print

Also try
cd $HOME
ls -l | grep $2

I think that everyon is trying too hard.

find /home -name "ass*" -print

this will search recursively through all home dirs under /home, change this to match your home directory.

Here is a better way.

If you only want to find certain users from one group. Do this.

grep UID /etc/passwd | awk -F: '{ print $1}' > /tmp/users.id
HOME=`/tmp/users.id`
for name in $HOME
do
find ~$HOME -name "ass*" -print
done

Where the UID is the group that you want to search their home directory.

You guys are going off topic, lol

sorry, im making a script for school that runs like this
file is called search

search [filename] [top dir]

and in my code i have
find $2 -name "$1" -print

but thats not working, am i supposed to declare some variable or something to get this to work?

it just gives that error i posted above, something about USage:

thanks, steve

This site does have a policy about posting homework. They usually frown on it.

So, if you post in the future, try to make it a "real world" question.

Thanks :wink: