<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Darn you, failglob</title>
	<link>http://briancarper.net/2007/05/05/darn-you-failglob/</link>
	<description></description>
	<pubDate>Thu, 28 Aug 2008 05:17:07 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.2</generator>
		<item>
		<title>By: Brian</title>
		<link>http://briancarper.net/2007/05/05/darn-you-failglob/#comment-7478</link>
		<dc:creator>Brian</dc:creator>
		<pubDate>Thu, 01 Nov 2007 00:30:39 +0000</pubDate>
		<guid>http://briancarper.net/2007/05/05/darn-you-failglob/#comment-7478</guid>
		<description>Yeah, that makes sense.  Thanks for clearing that up.

When I set nullglob, if I do `ls *ZZZ` it actually does `ls` if the glob matches nothing.  That seems kind of dangerous for any command that defaults to doing something on all files if the file list is missing.  Globs are so messy.  Can't live with them, can't live without them.</description>
		<content:encoded><![CDATA[<p>Yeah, that makes sense.  Thanks for clearing that up.</p>
<p>When I set nullglob, if I do `ls *ZZZ` it actually does `ls` if the glob matches nothing.  That seems kind of dangerous for any command that defaults to doing something on all files if the file list is missing.  Globs are so messy.  Can't live with them, can't live without them.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Richard Neill</title>
		<link>http://briancarper.net/2007/05/05/darn-you-failglob/#comment-7474</link>
		<dc:creator>Richard Neill</dc:creator>
		<pubDate>Wed, 31 Oct 2007 20:59:40 +0000</pubDate>
		<guid>http://briancarper.net/2007/05/05/darn-you-failglob/#comment-7474</guid>
		<description>I can tell you why failglob is good and why it is bad. 
Consider a shell script, running:

i=0; for file in *ZZZ; do let i++; done; echo "There are $i files matching '*.ZZZ'"

[This should count the number of files ending in the .ZZZ extension]

What happens if you haven't got any files ending in .ZZZ?

By default, bash will fail to expand (glob) "*.ZZZ", and will fall-back to evaluating it as a literal '*.ZZZ'.

You will get the wrong answer, i.e. 1.

failglob will make bash throw an error. nullglob is probably what you want.</description>
		<content:encoded><![CDATA[<p>I can tell you why failglob is good and why it is bad.<br />
Consider a shell script, running:</p>
<p>i=0; for file in *ZZZ; do let i++; done; echo &#8220;There are $i files matching &#8216;*.ZZZ'&#8221;</p>
<p>[This should count the number of files ending in the .ZZZ extension]</p>
<p>What happens if you haven't got any files ending in .ZZZ?</p>
<p>By default, bash will fail to expand (glob) &#8220;*.ZZZ&#8221;, and will fall-back to evaluating it as a literal &#8216;*.ZZZ'.</p>
<p>You will get the wrong answer, i.e. 1.</p>
<p>failglob will make bash throw an error. nullglob is probably what you want.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
