Click to See Complete Forum and Search --> : find script


bsh152s
09-20-2001, 06:02 PM
I'm trying to simplify a command that I use a lot, but I'm getting errors. The command I use is find dir -name "my_str" -print . So, I wrote a one line script, find $1 -name $2 -print , to simplify it. This works fine except when I include wildcard characters such as '*' and '?'. I get the errors "bad option" and "path-list predicate-list". How can I work around this? I think the shell is interpreting the * and ? before the script receive them.

bsh152s
09-20-2001, 06:07 PM
Nevermind, I fixed it. But, I don't know how. In the script, I put the $2 in parentheses like so: find $1 -name "$2" -print Now, can anyone tell me why this worked?