HP3000-L Archives

October 2001, Week 4

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Reply To:
Date:
Mon, 22 Oct 2001 17:16:14 -0600
Content-Type:
text/plain
Parts/Attachments:
text/plain (46 lines)
Hello,
I need help with the find command for a korn shell script I am
writting for the HP-UX rel 10.20. When I attempt to use a variable in
the following statements I get hits for files that I wanted to be
excluded. If I replace the contents of the variable directly into the
statement, then the output is OK. It appear to me that when a variable
is used the single qoute (') around *.fail are being interprited wrong
(yes, the  must be there or it will not work if there are more that
one file of that type). I realize this seems trivial but this is just
an example. The real variable I intend to use has about 35 different
file types that I am trying to exclude and is used in multiple places.


to try this out, create the following four test files containing any
text.
find_ok_1.fail
find_ok_2.fail
find_ok_1.pass
find_ok_2.pass


execute the following and the output is correct.


for i in `find . \( -type f ! -name '*.fail' \)`
do
   echo $i
done


now, execute this and it doesn't work (it finds the "fail" files)

file_exclude="-type f ! -name '*.fail'"
for i in `find . \( $file_exclude \)`
do
   echo $i
done



Any help would be appreciated
Thanks

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2