{"id":87,"date":"2013-11-05T21:00:00","date_gmt":"2013-11-05T21:00:00","guid":{"rendered":"http:\/\/www.b.shuttle.de\/hayek\/Hayek\/Jochen\/wp\/blog-en\/2013\/11\/05\/the-bashs-nullglob-is-rather-nice-to-use\/"},"modified":"2013-11-05T21:00:00","modified_gmt":"2013-11-05T21:00:00","slug":"the-bashs-nullglob-is-rather-nice-to-use","status":"publish","type":"post","link":"https:\/\/wp.jochen.hayek.name\/blog-en\/2013\/11\/05\/the-bashs-nullglob-is-rather-nice-to-use\/","title":{"rendered":"the bash&#8217;s &#8220;shell option&#8221; (&#8220;shopt&#8221;) &#8220;nullglob&#8221; is rather nice to use"},"content":{"rendered":"<ul>\n<li><a href=\"http:\/\/www.gnu.org\/software\/bash\/manual\/html_node\/Filename-Expansion.html\">http:\/\/www.gnu.org\/software\/bash\/manual\/html_node\/Filename-Expansion.html<\/a><\/li>\n<li><a href=\"http:\/\/www.gnu.org\/software\/bash\/manual\/html_node\/The-Shopt-Builtin.html\">http:\/\/www.gnu.org\/software\/bash\/manual\/html_node\/The-Shopt-Builtin.html<\/a>\n<p>w\/o this command line:<\/li>\n<\/ul>\n<blockquote><p>$ shopt -s nullglob<\/p><\/blockquote>\n<p>a glob pattern, that does not successfully evaluate to existing file names, gets literally resolved to a file name identical to the glob pattern.<br \/>\nWith the above command line executed already, this command line will print file infos of \/etc\/passwd and ignore the unsuccessful other two glob patterns:<\/p>\n<blockquote><p>$ ll \/etc\/passwd \/etc\/passwd? \/etc\/passwd??<\/p><\/blockquote>\n<p>In interactive mode you may want to see the error messages, within a shell script supplying all three parameters to a &#8220;for f in \u2026&#8221; loop, you will want the unresolving ones to get ignored.<\/p>\n<blockquote><p>$ for f in\u00a0\/etc\/passwd \/etc\/passwd? \/etc\/passwd??; do echo $f; done<\/p><\/blockquote>\n<p>Well, at least in my script today I found this option rather useful.<\/p>\n<p>I tried to find something comparable in the Korn Shell, but I wasn&#8217;t successful.\t\t\t\t<\/p>\n","protected":false},"excerpt":{"rendered":"<p>http:\/\/www.gnu.org\/software\/bash\/manual\/html_node\/Filename-Expansion.html http:\/\/www.gnu.org\/software\/bash\/manual\/html_node\/The-Shopt-Builtin.html w\/o this command line: $ shopt -s nullglob a glob pattern, that does not successfully evaluate to existing file names, gets literally resolved to a file name identical to the glob pattern. With the above command line executed already, this command line will print file infos of \/etc\/passwd and ignore the unsuccessful other [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false,"_share_on_mastodon":"0"},"categories":[666],"tags":[],"class_list":["post-87","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"share_on_mastodon":{"url":"","error":""},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/paO0kP-1p","jetpack_likes_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/posts\/87","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/comments?post=87"}],"version-history":[{"count":0,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/posts\/87\/revisions"}],"wp:attachment":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/media?parent=87"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/categories?post=87"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/tags?post=87"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}