I find it more ...funny... written like this one line for each directory to exclude, no need to edit/change their names, just note the leading \ on the last one
#!/bin/sh call="find $(echo '\ /mnt/dosc/windows /mnt/dosc/Program Files /mnt/dosc/rom_zips\ ' | while read line do echo "-path '$line' -prune -o " done)" echo $call eval "$call" you could even shorten it to : #!/bin/sh eval "find $(echo '\ ... done)" A 23:35 19/02/02 -0600, vous avez écrit : >Lynne, thanks for the info...your script produces what I need, except >that my arguments are not on separate lines. However, I have managed to >write the following script that allows "Program\_Files" to be passed as >'Program Files' to find. Especially important was the eval ($call) >(also thanks to Cameron). This seems to have removed the problem that >find was having. I also think that using the \_ is better than the >question mark and I can replace it with a space in the loop. Here is >what I ended up with: > >#!/bin/sh > >paths_to_exclude='/mnt/dosc/windows /mnt/dosc/quickenw >/mnt/dosc/Program\_Files /mnt/dosc/rom_zips' >call="find /mnt/dosc/" > >for i in $paths_to_exclude ; do > i=$(echo $i | sed 's/\\_/ /g') > call="$call -path '$i' -prune -o" >done > >call="$call -print" >echo $call >eval "$call" > > > > >Thanks for everyone's help in steering this to a conclusion. > >Kirk > > > > > > >Lynne wrote: >Kirk, > >Try something like the following - this works for me. The set -x >provides a >"trace" and should be removed for actual use. > >#!/bin/sh >set -x >paths_to_exclude='/tmp/dir1/Program Files >/tmp/fileobJEbT-rep-tarfh >/tmp/orbit* >/tmp/quickenw' > >call=`echo "$paths_to_exclude" | ( stuff= > while read line > do > stuff="$stuff -path '$line' -prune -o" > done > echo $stuff)` > >call="find /tmp/ $call" > >call="$call -print" >echo "Calling..." >echo $call >eval $call > >Lynne >kirk wrote: > >> I am trying to get a list of /mnt/dosc excluding "Program Files" and >> "quickenw" from within this script. This is a stripped down version of >> what would normally include variables, but it illustrates the concept. >> >> Here is the script: >> >> #!/bin/sh >> paths_to_exclude="/mnt/dosc/Program?Files /mnt/dosc/quickenw" >> call="find /mnt/dosc/" >> >> for i in $paths_to_exclude ; do >> call="$call -path '"$i"' -prune -o" >> done >> >> call="$call -print" >> echo "Calling..." >> echo $call >> $call >> >> [end script] >> >> Running this script generates the following: >> >> Calling... >> find /mnt/dosc/ -path '/mnt/dosc/Program Files' -prune -o -path >> '/mnt/dosc/quickenw' -prune -o -print >> find: paths must precede expression >> Usage: find [path...] [expression] >> >> However, running the command >> find /mnt/dosc/ -path '/mnt/dosc/Program Files' -prune -o -path >> '/mnt/dosc/quickenw' -prune -o -print >> >> Generates the desired output. >> >> I assume part of the problem is the "?", but I have to keep the string >> together or the for loop breaks it up. Is there any other way to get >> this thing to go thru the for loop intact? Also, why does running the >> same command as $call work from the command prompt? >> >> Any help would be appreciated. >> >> Kirk >> >> _______________________________________________ >> Redhat-list mailing list >> [EMAIL PROTECTED] >> https://listman.redhat.com/mailman/listinfo/redhat-list > > > >_______________________________________________ >Redhat-list mailing list >[EMAIL PROTECTED] >https://listman.redhat.com/mailman/listinfo/redhat-list > > - * - * - * - * - * - * - Bien sûr que je suis perfectionniste ! Mais ne pourrais-je pas l'être mieux ? Thierry ITTY eMail : [EMAIL PROTECTED] FRANCE _______________________________________________ Redhat-list mailing list [EMAIL PROTECTED] https://listman.redhat.com/mailman/listinfo/redhat-list