whats wrong with this find statement ?

cmd="find /a/technologies -name '*.jar' | grep \"Tuning/specificloader/lib\""
echo $cmd
for index in `$cmd`

     do
         SL\_JARS="$\{SL_JARS\}:$\{index\}"
    done

gives error ==>
find: paths must precede expression
Usage: find [-H] [-L] [-P] [path...] [expression]

but

for index in `find /a/technologies -name *.jar | grep "Tuning/specificloader/lib"`

     do
         SL\_JARS="$\{SL_JARS\}:$\{index\}"
    done

is working fine

Maybe better fill the variable like an array like this:

list="`find /a/technologies -name '*.jar' -print | grep \"Tuning/specificloader/lib\"`"

I added backticks in front and at the end of the command string so it will be substituted right there and assigned to the varaiable like a list.
You will have problems using it this way when you have blanks in file or directory names anyway.
I also added a -print since some versions of find might want it to print output in terms of portability.

Then when using it in the for-loop you just insert `$cmd` vs. $list.

Hi,

When you are substituting the output of a command to a varibale you must use the backticks ( The one below the ~ sign in keyboard).

so the substitution will be like this--


cmd="`find /a/technologies -name '*.jar' | grep \"Tuning/specificloader/lib\"`"

Thanks
NT