Set bash's shell option nullglob by default?
Bryn M. Reeves
bmr at redhat.com
Fri Jul 13 12:31:46 UTC 2012
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 07/13/2012 01:06 PM, Scott Schmit wrote:
> On Fri, Jul 13, 2012 at 01:56:29PM +0200, Roman Rakus wrote:
>> Hi, I have a question about nullglob bash's shell option. I want
>> to hear opinions. The behavior is nicely described in bash
>> reference manual [1] By default, the nullglob is turned off. And
>> it tends people to use bad habits in shell scripting. In my POV
>> the nullglob could be turned on by default. However, i would like
>> to hear opinions from others.
>>
>> It is possible it can break many scripts even in rpm's
>> scriptlets, but as I already said, it's because bad habits. So
>> the main gain will be the people will learn how is the globbing
>> in bash and in the whole environment working.
>
> So ls *.foo should list the entire directory if no files match
> *.foo? It's a bad habit for me to expect ls *.foo to return nothing
> in this case? You're going to need to convince me.
I wouldn't back this change either but that's not the behaviour of
nullglob. If nothing matches the glob the word remains unchanged (i.e.
*.foo -> *.foo):
$ ls *.foo
ls: cannot access *.foo: No such file or directory
$ echo *.foo
*.foo
Regards,
Bryn.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAlAAFTIACgkQ6YSQoMYUY956BgCgicpLdJr4nM7NBwYOSJS9kQVe
8qoAoJKEtqaWJ0SAbT2UXK7URkSaxXV+
=H6xC
-----END PGP SIGNATURE-----
More information about the devel
mailing list