[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



Thanks,

-- Joe

Joe Knapka <jknapka at kneuro.net> writes:

> Hi folks,
> 
> A simple Bash question that google, the Bash FAQ, and the
> comp.unix.shell FAQ have failed to answer. (Possibly man bash would
> answer it, but I find I usually fall asleep before finding the
> particular tidbit I'm looking for in that horrendously gigantic
> manpage. Plus I expect there are folks on this list who do this
> kind of thing six times before breakfast.)
> 
> I need to do this:
> 
> if (any file matching *.h exists); then do something; fi
> 
> The "any file matching *.h" test is defeating me. No variety of "[ -e
> ... ]" seems to work (quoting the "*.h" different ways, and so
> forth). I've also tried
> 
> for f in *.h ; do something to $f ; done
> 
> That works except when there are *not* any *.h files, in which case it
> binds f to the literal string "*.h" instead, which causes bad stuff to
> happen in the "do something to $f" part. Since I'm doing this inside
> of a generic rule in a common make file for a development tree, I
> really need the command to work properly even in directories that
> don't contain any *.h files (in which case it should simply do
> nothing, not cause an error condition).
> 
> Any assistance is appreciated.
> 
> Thanks,
> 
> -- Joe
> 
> -- 
> "We sat and watched as this whole       <-- (Died Pretty -- "Springenfall")
>  blue sky turned to black..."
> ... Re-defeat Bush in '04.
> --
> pub  1024D/BA496D2B 2004-05-14 Joseph A Knapka
>      Key fingerprint = 3BA2 FE72 3CBA D4C2 21E4  C9B4 3230 94D7 BA49 6D2B
> If you really want to get my attention, send mail to
> jknapka .at. kneuro .dot. net.
> 
> 

-- 
"We sat and watched as this whole       <-- (Died Pretty -- "Springenfall")
 blue sky turned to black..."
... Re-defeat Bush in '04.
--
pub  1024D/BA496D2B 2004-05-14 Joseph A Knapka
     Key fingerprint = 3BA2 FE72 3CBA D4C2 21E4  C9B4 3230 94D7 BA49 6D2B
If you really want to get my attention, send mail to
jknapka .at. kneuro .dot. net.


</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<!--X-Follow-Ups-End-->
<!--X-References-->
<ul><li><strong>References</strong>:
<ul>
<li><strong><a name="00215" href="msg00215.html">[ale] Q: Bash: test for existence of any file matching a glib	pattern.</a></strong>
<ul><li><em>From:</em> jknapka at kneuro.net (Joe Knapka)</li></ul></li>
</ul></li></ul>
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg00215.html">[ale] Q: Bash: test for existence of any file matching a glib	pattern.</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg00217.html">[ale] Q: Bash: test for existence of any file matching a glib	pattern.</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg00215.html">[ale] Q: Bash: test for existence of any file matching a glib	pattern.</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg00217.html">[ale] Q: Bash: test for existence of any file matching a glib	pattern.</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#00216"><strong>Date</strong></a></li>
<li><a href="threads.html#00216"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>