{"id":83682,"date":"2020-10-07T11:00:56","date_gmt":"2020-10-07T08:00:56","guid":{"rendered":"https:\/\/en.buradabiliyorum.com\/how-to-customize-the-bash-shell-with-shopt\/"},"modified":"2022-02-02T20:06:19","modified_gmt":"2022-02-02T17:06:19","slug":"how-to-customize-the-bash-shell-with-shopt","status":"publish","type":"post","link":"https:\/\/buradabiliyorum.com\/en\/how-to-customize-the-bash-shell-with-shopt\/","title":{"rendered":"#How to Customize the Bash Shell With shopt"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_85 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a2fdedcd4de9\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #dd3333;color:#dd3333\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #dd3333;color:#dd3333\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a2fdedcd4de9\" checked aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-customize-the-bash-shell-with-shopt\/#%E2%80%9CHow_to_Customize_the_Bash_Shell_With_shopt%E2%80%9D\" >&#8220;#How to Customize the Bash Shell With shopt&#8221;<\/a><ul class='ez-toc-list-level-2' ><li class='ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-customize-the-bash-shell-with-shopt\/#The_shopt_Built-in\" >The shopt Built-in<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-customize-the-bash-shell-with-shopt\/#The_shopt_Options\" >The shopt Options<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-customize-the-bash-shell-with-shopt\/#Finding_shopt_in_the_Linux_Manual\" >Finding shopt in the Linux Manual<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-customize-the-bash-shell-with-shopt\/#Setting_and_Unsetting_Options\" >Setting and Unsetting Options<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-customize-the-bash-shell-with-shopt\/#The_autocd_Option\" >The autocd Option<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-customize-the-bash-shell-with-shopt\/#The_cdspell_Option\" >The cdspell Option<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-customize-the-bash-shell-with-shopt\/#The_xpg_echo_Option\" >The\u00a0xpg_echo Option<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-customize-the-bash-shell-with-shopt\/#The_dotglob_Option\" >The dotglob Option<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-customize-the-bash-shell-with-shopt\/#The_nocaseglob_Option\" >The\u00a0nocaseglob Option<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-customize-the-bash-shell-with-shopt\/#Making_Changes_Permanent\" >Making Changes Permanent<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-customize-the-bash-shell-with-shopt\/#Options_as_Far_as_the_Eye_Can_See\" >Options as Far as the Eye Can See<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h1><span class=\"ez-toc-section\" id=\"%E2%80%9CHow_to_Customize_the_Bash_Shell_With_shopt%E2%80%9D\"><\/span><strong>&#8220;#How to Customize the Bash Shell With shopt&#8221;<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h1>\n<div>\n<figure id=\"attachment_442612\" class=\"wp-caption alignnone\" style=\"width: 650px;\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-442612 size-full\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2019\/09\/xstock-lede-linux-see-attribution.png.pagespeed.gp+jp+jw+pj+ws+js+rj+rp+rw+ri+cp+md.ic.rjm91kC_Jl.png\" alt=\"A terminal prompt on a Linux laptop.\" width=\"650\" height=\"300\" data-crediturl=\"https:\/\/www.shutterstock.com\/image-vector\/linux-interface-screen-notebook-world-map-321627716\" data-credittext=\"Fatmawati Achmad Zaenuri\/Shutterstock\" \/><figcaption class=\"wp-caption-text\"><span class=\"imagecredit\"><a href=\"https:\/\/www.shutterstock.com\/image-vector\/linux-interface-screen-notebook-world-map-321627716\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Fatmawati Achmad Zaenuri\/Shutterstock<\/a><\/span><\/figcaption><\/figure>\n<p>If you fine-tune the behavior of your Bash shell with <code>shopt<\/code>, you can control over 50 settings. We\u2019ll show you how to tailor your Linux system just the way you like it.<\/p>\n<h2 id=\"the-shopt-builtin\"><span class=\"ez-toc-section\" id=\"The_shopt_Built-in\"><\/span>The shopt Built-in<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The <code>shopt<\/code> built-in is part of all versions of the\u00a0<a href=\"https:\/\/www.man7.org\/linux\/man-pages\/man1\/bash.1.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Bash shell<\/a>, so there\u2019s no need to install anything. The number of options available in\u00a0<code>shopt<\/code> has increased steadily over the years. So, the older the version of Bash you have, the shorter the list of <code>shopt<\/code> options will be.<\/p>\n<p>If something doesn\u2019t seem to be working on your machine, check the <code>man<\/code> page entry for Bash and verify that option is available in your version of <code>shopt<\/code>.<\/p>\n<p>We cover all the\u00a0<code>shopt<\/code> options below. We also describe how to use it and share some examples. From there, you can check out the Bash man page or <a href=\"https:\/\/www.gnu.org\/software\/bash\/manual\/html_node\/The-Shopt-Builtin.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">GNU Bash Reference Manual<\/a>\u00a0to see whether any of those options sound useful or <a href=\"https:\/\/buradabiliyorum.com\/en\/category\/download-scripts-themes-apps\/\" data-internallinksmanager029f6b8e52c=\"9\" title=\"Download Scripts &amp; Themes &amp; Apps\" target=\"_blank\" rel=\"noopener\">app<\/a>ealing.<\/p>\n<p>Some <code>shopt<\/code> options are enabled by default and form part of Bash\u2019s default behavior. You can enable a <code>shopt<\/code> option as a short-term change to Bash. It will then revert to the default behavior when you close the shell.<\/p>\n<p>However, if you want a modified behavior to be available whenever you launch a Bash shell, you can make the changes permanent.<\/p>\n<h2 id=\"the-shopt-options\"><span class=\"ez-toc-section\" id=\"The_shopt_Options\"><\/span>The shopt Options<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>There are 53 <code>shopt<\/code> options. If you use the <code>shopt<\/code> command without any options, it lists these. If we pipe the output through the <code>wc<\/code> command, it will <a href=\"https:\/\/man7.org\/linux\/man-pages\/man1\/wc.1.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">count the lines, words, and characters<\/a> for us. Because each <code>shopt<\/code> option is on its own line, the number of lines is the number of options.<\/p>\n<p>We type the following:<\/p>\n<pre>shopt | wc<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-691986 size-full\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2020\/09\/x1-5.png.pagespeed.gp+jp+jw+pj+ws+js+rj+rp+rw+ri+cp+md.ic.kidiv1C4Oj.png\" alt=\"shopt | wc in a terminal window.\" width=\"646\" height=\"97\" \/><\/p>\n<p>To see all of the options, we can pipe the output through the <code>column<\/code> command <a href=\"https:\/\/man7.org\/linux\/man-pages\/man1\/column.1.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">to display the option names in columns<\/a>, or we could pipe it into <code>less<\/code>.<\/p>\n<p>We type the following:<\/p>\n<pre>shopt | column<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-691989 size-full\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2020\/09\/x2-3.png.pagespeed.gp+jp+jw+pj+ws+js+rj+rp+rw+ri+cp+md.ic.p0CPzikQM_.png\" alt=\"shopt | column in a terminal window.\" width=\"646\" height=\"382\" \/><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Finding_shopt_in_the_Linux_Manual\"><\/span>Finding shopt in the Linux Manual<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The section discussing <code>shopt<\/code> and its options is in the Bash section of the Linux manual.\u00a0The Bash section is over 6,000 lines long. You can find the description of <code>shopt<\/code> with a lot of scrolling, or you can just search for it within the manual.<\/p>\n<p>To do so, open the manual at the Bash section:<\/p>\n<pre>man bash<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-691990 size-full\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2020\/09\/x3-3.png.pagespeed.gp+jp+jw+pj+ws+js+rj+rp+rw+ri+cp+md.ic.B-MD7N8pw4.png\" alt=\"man bash in a terminal window.\" width=\"646\" height=\"57\" \/><\/p>\n<p>In the manual, press <code>\/<\/code> to start a search. Type the following, and then press Enter:<\/p>\n<pre>assoc_expand_once<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-691991 size-full\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2020\/09\/x4-4.png.pagespeed.gp+jp+jw+pj+ws+js+rj+rp+rw+ri+cp+md.ic.82BExWKdOA.png\" alt=\"Bash section of the manual, with a search term entered on the command line in a terminal window.\" width=\"646\" height=\"382\" \/><\/p>\n<p>The start of the <code>shopt<\/code>option section will appear in the <code>man<\/code> window.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-691992 size-full\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2020\/09\/x5-2.png.pagespeed.gp+jp+jw+pj+ws+js+rj+rp+rw+ri+cp+md.ic.QwAhVA04oV.png\" alt=\"The manual showing the shopt option section of the Bash man page in a terminal window.\" width=\"646\" height=\"382\" \/><\/p>\n<p><strong>RELATED:<\/strong> <strong><em>How to Use Linux&#8217;s man Command: Hidden Secrets and Basics<\/em><\/strong><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Setting_and_Unsetting_Options\"><\/span>Setting and Unsetting Options<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>To set and unset <code>shopt<\/code> options, use the following commands:<\/p>\n<ul>\n<li><strong>-s<\/strong>: Set, or enable.<\/li>\n<li><strong>-u<\/strong>: Unset, or disable.<\/li>\n<\/ul>\n<p>Because some options are enabled by default, it\u2019s also handy to check which options are on. You can do so with the <code>-s<\/code> and <code>-u<\/code> options without using an option name. This causes <code>shopt<\/code> to list the options that are on and off.<\/p>\n<p>Type the following:<\/p>\n<pre>shopt -s<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-691994 size-full\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2020\/09\/x6-2.png.pagespeed.gp+jp+jw+pj+ws+js+rj+rp+rw+ri+cp+md.ic.YFnA-20hL9.png\" alt=\"shopt -s in a terminal window.\" width=\"646\" height=\"337\" \/><\/p>\n<pre>shopt -u | column<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-691995 size-full\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2020\/09\/x7-2.png.pagespeed.gp+jp+jw+pj+ws+js+rj+rp+rw+ri+cp+md.ic.2yzTcMPSJ5.png\" alt=\"shopt -u | column in a terminal window.\" width=\"646\" height=\"382\" \/><\/p>\n<p>You can use a <code>shopt<\/code> option without the\u00a0<code>-s<\/code> or <code>-u<\/code>\u00a0commands to see the on or off state for each option.<\/p>\n<p>For example, we can type the following to check the setting of the <code>histverify<\/code> option:<\/p>\n<pre>shopt histverify<\/pre>\n<p>We can type the following to set it to on:<\/p>\n<pre>shopt -s histverify<\/pre>\n<p>Then, we can type the following to check it again:<\/p>\n<pre>shopt histverify<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-692004 size-full\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2020\/09\/x8-1.png.pagespeed.gp+jp+jw+pj+ws+js+rj+rp+rw+ri+cp+md.ic.rQ_G-wodIQ.png\" alt=\"shopt histverify in a terminal window.\" width=\"646\" height=\"147\" \/><\/p>\n<p>The <code>histverify<\/code> option changes how one aspect of the <code>history<\/code> command operates. Usually, if you ask <code>history<\/code> to repeat a command by referencing it by number, like <code>!245<\/code>, the command is retrieved from the command history and executed im<a href=\"https:\/\/buradabiliyorum.com\/en\/category\/social-mediaa\/\" data-internallinksmanager029f6b8e52c=\"1\" title=\"Social Media\" target=\"_blank\" rel=\"noopener\">media<\/a>tely.<\/p>\n<p>If you prefer to review a command to make sure it\u2019s the one you expected and edit it, if necessary, type the following to set the <code>shopt histverify<\/code> option to on:<\/p>\n<pre>!245<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-692006 size-full\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2020\/09\/x9-2.png.pagespeed.gp+jp+jw+pj+ws+js+rj+rp+rw+ri+cp+md.ic.h-tQkWJ0V9.png\" alt=\"!245 in a terminal window.\" width=\"646\" height=\"97\" \/><\/p>\n<p>The command is retrieved and presented on the command line. You can either delete, edit, or execute it by pressing Enter.<\/p>\n<p><strong>RELATED:<\/strong> <strong><em>How to Use the history Command on Linux<\/em><\/strong><\/p>\n<h2><span class=\"ez-toc-section\" id=\"The_autocd_Option\"><\/span>The autocd Option<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>With the <code>autocd<\/code> option set to on, if you type the name of a directory on the command line and press Enter, it will be treated as if you\u2019ve typed <code>cd<\/code> in front of it.<\/p>\n<p>We type the following to turn on the <code>autocd<\/code> option:<\/p>\n<pre>shopt -s autocd<\/pre>\n<p>Then, we type the name of a directory:<\/p>\n<pre>Documents<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-692015 size-full\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2020\/09\/x11-1.png.pagespeed.gp+jp+jw+pj+ws+js+rj+rp+rw+ri+cp+md.ic.U0P22xSWns.png\" alt=\"shopt -s autocd in a terminal window.\" width=\"646\" height=\"122\" \/><\/p>\n<h2><span class=\"ez-toc-section\" id=\"The_cdspell_Option\"><\/span>The cdspell Option<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>When the <code>cdspell<\/code> option is turned on, Bash will automatically correct simple spelling mistakes and typos in directory names.<\/p>\n<p>We type the following to set the <code>cdspell<\/code> option:<\/p>\n<pre>shopt -s cdspell<\/pre>\n<p>To try to change into a directory in lowercase that should have an uppercase initial letter, we type the following:<\/p>\n<pre>cd documents<\/pre>\n<p>Then, we can type the following to try a directory name with an extra \u201ct\u201d in its name:<\/p>\n<pre>cd ..\/Picttures<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-692034 size-full\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2020\/09\/x12-4.png.pagespeed.gp+jp+jw+pj+ws+js+rj+rp+rw+ri+cp+md.ic.7wAqIiyCr4.png\" alt=\"shopt -s cdspell in a terminal window.\" width=\"646\" height=\"147\" \/><\/p>\n<p>Bash changes into each directory, regardless of the spelling mistakes.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"The_xpg_echo_Option\"><\/span>The\u00a0xpg_echo Option<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>When the <code>xpg_echo<\/code> option is set to on, the echo command will obey escaped characters, like <code>n<\/code> for new line and <code>t<\/code> for horizontal tab.<\/p>\n<p>First, we type the following to make sure the option is set:<\/p>\n<pre>shopt -s xpg_echo<\/pre>\n<p>We then include <code>n<\/code> in a string we\u2019re going to pass to <code>echo<\/code>:<\/p>\n<pre>echo \"This is line onenThis is line two\"<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-692043 size-full\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2020\/09\/x13-2.png.pagespeed.gp+jp+jw+pj+ws+js+rj+rp+rw+ri+cp+md.ic.SxqwBVeTm0.png\" alt=\"shopt -s xpg_echo in a terminal window.\" width=\"646\" height=\"132\" \/><\/p>\n<p>The escaped new-line character forces a line break in the output.<\/p>\n<p>This produces the same behavior as the <code>-e<\/code> (<a href=\"https:\/\/man7.org\/linux\/man-pages\/man1\/echo.1.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">enable escape interpretation<\/a>) <code>echo<\/code> option,\u00a0 but <code>xpg_echo <\/code> allows it to be the default action.<\/p>\n<p><strong>RELATED:<\/strong> <strong><em>How to Use the Echo Command on Linux<\/em><\/strong><\/p>\n<h2><span class=\"ez-toc-section\" id=\"The_dotglob_Option\"><\/span>The dotglob Option<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The <code>dotglob<\/code> option should be treated with a bit of caution. It allows files and directories that start with a period (<code>.<\/code>) to be included in name expansions or \u201cglobbing.\u201d These are called \u201cdot files\u201d or \u201cdot directories\u201d and they\u2019re usually hidden. The <code>dotglob<\/code> option ignores the dot at the start of their names.<\/p>\n<p>First, we\u2019ll do a search for files or directories that end in \u201cgeek\u201d by typing the following:<\/p>\n<pre>ls *geek<\/pre>\n<p>One file is found and listed. Then, we\u2019ll turn on the <code>dotglob<\/code> option by typing the following:<\/p>\n<pre>shopt -s dotglob<\/pre>\n<p>We issue the same <code>ls<\/code> command to look for files and directories ending in \u201cgeek\u201d:<\/p>\n<pre>ls *geek<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-692047 size-full\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2020\/09\/x14-2.png.pagespeed.gp+jp+jw+pj+ws+js+rj+rp+rw+ri+cp+md.ic.LukrX4gOuK.png\" alt=\"ls *geek in a terminal window.\" width=\"646\" height=\"147\" \/><\/p>\n<p>This time two files are found and listed, one of which is a dot file. You need to be careful with <code>rm<\/code> and <code>mv<\/code> when you\u2019ve got the <code>dotglob<\/code> option set to on.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"The_nocaseglob_Option\"><\/span>The\u00a0nocaseglob Option<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The <code>nocaseglob<\/code> option is similar to the <code>dotglob<\/code> option, except <code>nocaseglob<\/code> causes differences in upper- and lowercase letters in file names and directories to be ignored in name expansions.<\/p>\n<p>We type the following to look for files or directories that start with \u201chow\u201d:<\/p>\n<pre>ls how*<\/pre>\n<p>One file is found and listed. We type the following to turn on the <code>nocaseglob<\/code> option:<\/p>\n<pre>shopt -s nocaseglob<\/pre>\n<p>Then, we repeat the <code>ls<\/code> command:<\/p>\n<pre>ls how*<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-692069 size-full\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2020\/09\/x15-1.png.pagespeed.gp+jp+jw+pj+ws+js+rj+rp+rw+ri+cp+md.ic.DRIKHxomoO.png\" alt=\"ls how* in a terminal window.\" width=\"646\" height=\"147\" \/><\/p>\n<p>Two files are found, one of which contains uppercase letters.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Making_Changes_Permanent\"><\/span>Making Changes Permanent<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The changes we\u2019ve made will only last until we close the current Bash shell. To make them permanent across different shell sessions, we need to add them to our \u201c.bashrc\u201d file.<\/p>\n<p>In your home directory, type the following command to open the \u201c.bashrc\u201d file in the graphical Gedit text editor (or change it accordingly to use the editor you prefer):<\/p>\n<pre>gedit .bashrc<\/pre>\n<p>The <code>gedit<\/code> editor will open with the \u201c.bashrc\u201d file loaded. You\u2019ll see some <code>shopt<\/code> entries are already in it.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-692082 size-full\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2020\/09\/x10-2.png.pagespeed.gp+jp+jw+pj+ws+js+rj+rp+rw+ri+cp+md.ic.9ErWjL_KKl.png\" alt=\"The gedit editor with .bashrc loaded in it, and shopt options highlighted.\" width=\"646\" height=\"237\" \/><\/p>\n<p>You can add your own <code>shopt<\/code> options here, as well. When you\u2019ve added them, save your changes and close the editor. Now, whenever you open a new Bash shell, your options will be set for you.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Options_as_Far_as_the_Eye_Can_See\"><\/span>Options as Far as the Eye Can See<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>It\u2019s true the <code>shopt<\/code> command has a lot of options, but you don\u2019t have to come to grips with them all at once, if ever. Since there are so many, there are likely some that will be of no interest to you.<\/p>\n<p>For example, there are a bunch that force Bash to operate in ways that are compatible with specific, older versions. That might be useful for someone, but it\u2019s a fairly niche case.<\/p>\n<p>You can review the Bash <a href=\"https:\/\/www.man7.org\/linux\/man-pages\/man1\/bash.1.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">man page<\/a>\u00a0or <a href=\"https:\/\/www.gnu.org\/software\/bash\/manual\/html_node\/The-Shopt-Builtin.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">GNU Bash Reference Manual<\/a>. Decide which options are going to make a difference for you, and then experiment with them. Just be careful with options that affect the way file and directory names are expanded. Try them with a benign command, like <code>ls<\/code>, until you\u2019re comfortable with them.<\/p>\n<p><strong>Related article : <a href=\"https:\/\/www.pcwdld.com\/bash-cheat-sheet#wbounce-modal\" target=\"_blank\" rel=\"noopener\">BASH Cheat Sheet<\/a><\/strong><\/p>\n<\/div>\n<blockquote>\n<p style=\"text-align: center;\">For forums sites go to <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/forum.buradabiliyorum.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">Forum.BuradaBiliyorum.Com<\/a><\/span><\/p>\n<\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\"><strong>If you want to read more like this article, you can visit our <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/en.buradabiliyorum.com\/technology\/\" target=\"_blank\" rel=\"noopener noreferrer\">Technology category.<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<p><span style=\"color: black;\"><a style=\"color: #ff9900;\" href=\"https:\/\/www.howtogeek.com\/691980\/how-to-customize-the-bash-shell-with-shopt\/\" target=\"_blank\" rel=\"noopener noreferrer\">BASH Cheat Sheet<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8220;#How to Customize the Bash Shell With shopt&#8221; Fatmawati Achmad Zaenuri\/Shutterstock If you fine-tune the behavior of your Bash shell with shopt, you can control over 50 settings. We\u2019ll show you how to tailor your Linux system just the way you like it. The shopt Built-in The shopt built-in is part of all versions of&#8230;<\/p>\n","protected":false},"author":1,"featured_media":83683,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"https:\/\/www.howtogeek.com\/thumbcache\/2\/200\/de307e8ccc9856a4b842b6ca4a06c5ef\/wp-content\/uploads\/2019\/09\/stock-lede-linux-see-attribution.png","fifu_image_alt":"#How to Customize the Bash Shell With shopt","footnotes":""},"categories":[18],"tags":[125387,125383,125386,125376,125375,125382,125381,125380,125378,125377,125385,125384,125379],"class_list":["post-83682","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology","tag-bash-cheat-sheet","tag-finding-shopt-in-the-linux-manual","tag-how-to-customize-the-bash-shell-with-shopt","tag-making-changes-permanent","tag-options-as-far-as-the-eye-can-see","tag-setting-and-unsetting-options","tag-the-autocd-option","tag-the-cdspell-option","tag-the-dotglob-option","tag-the-nocaseglob-option","tag-the-shopt-built-in","tag-the-shopt-options","tag-the-xpg_echo-option"],"_links":{"self":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/83682","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/comments?post=83682"}],"version-history":[{"count":0,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/83682\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media\/83683"}],"wp:attachment":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media?parent=83682"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/categories?post=83682"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/tags?post=83682"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}