[comp.unix.questions] Help -- this seems simple!

rich@eddie.MIT.EDU (Richard Caloggero) (04/23/88)

     Can anyone tell me why this script doesn't print anything?

----------
#!/bin/sh
set -vx
names="-name '*.c' -o -name '*t*'"
find . \( $names \) -print

----------

     It doesn't print anything!
Thanx in advance.

----- Results of running the above script ... -----
Script started on Fri Apr 22 15:40:09 1988
% 
% test.sh^U
chmod a+x test.sh
% test.sh
names="-name '*.c' -o -name '*t*'"
names=-name '*.c' -o -name '*t*'
find . \( $names \) -print
+ find . ( -name '*.c' -o -name '*t*' ) -print 

% exit
% 
script done on Fri Apr 22 15:41:02 1988



     Could you mail me the answers since I don't
read these groups.



-- 
						-- Rich (rich@eddie.mit.edu).
	The circle is open, but unbroken.
	Merry meet, merry part,
	and merry meet again.

wswietse@eutrc3.UUCP (Wietse Venema) (04/24/88)

In article <8932@eddie.MIT.EDU> rich@eddie.MIT.EDU (Richard Caloggero) writes:
| 
| 
|      Can anyone tell me why this script doesn't print anything?
| 
| ----------
| #!/bin/sh
| set -vx
| names="-name '*.c' -o -name '*t*'"
| find . \( $names \) -print
| 
| ----------
| 
|      It doesn't print anything!
| Thanx in advance.

Try eval:

    names="-name '*.c' -o -name '*t*'"
    eval find . \( $names \) -print
-- 
uucp:	mcvax!eutrc3!wswietse	| Eindhoven University of Technology
bitnet:	wswietse@heithe5	| Dept. of Mathematics and Computer Science
surf:	tuerc5::wswietse	| Eindhoven, The Netherlands.