<div>[sean@sergeant:~]$ mkdir /tmp/nothing</div><div>[sean@sergeant:~]$ ls /tmp/nothing | while read A; do echo $A; done</div><div>[sean@sergeant:~]$</div><div><br></div><div>Also gets around nasty &quot;argument list too long&quot; messages and doesn&#39;t need you to remember arcane syntax. $A is quotable if you have spaces in the filename.</div>
<div><br></div><div>Sean</div><div><br></div><br><div class="gmail_quote">On Tue, Jul 6, 2010 at 11:07 PM, Adam Thompson <span dir="ltr">&lt;<a href="mailto:athompso@athompso.net">athompso@athompso.net</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I can&#39;t find what I&#39;m looking for in the bash(1) manpage, hoping there&#39;s an<br>
easy answer...<br>
<br>
I want to use a construct like<br>
        for i in ~/path/*; do something $i &amp;&amp; rm $i; done<br>
<br>
which works great as long as there are files in ~/path/.  However, when the<br>
directory is empty, I get:<br>
        rm: cannot remove `/home/athompso/path/*&#39;: No such file or directory<br>
<br>
which isn&#39;t quite what I want.  The quick fix in this case is to use<br>
        for i in ~/path/*; do [ -f $i ] &amp;&amp; something $i &amp;&amp; rm $i; done<br>
<br>
but once again, that strikes me as inelegant and I can&#39;t remember OR find<br>
the better way to do it.<br>
<br>
Anyone?<br>
<br>
Thanks,<br>
-Adam<br>
<br>
<br>
_______________________________________________<br>
Roundtable mailing list<br>
<a href="mailto:Roundtable@muug.mb.ca">Roundtable@muug.mb.ca</a><br>
<a href="http://www.muug.mb.ca/mailman/listinfo/roundtable" target="_blank">http://www.muug.mb.ca/mailman/listinfo/roundtable</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Sean Walberg &lt;<a href="mailto:sean@ertw.com">sean@ertw.com</a>&gt;    <a href="http://ertw.com/">http://ertw.com/</a><br>