{"id":2610,"date":"2024-10-30T23:34:53","date_gmt":"2024-10-31T03:34:53","guid":{"rendered":"http:\/\/sudlatnid.com\/?p=2610"},"modified":"2024-10-30T23:34:53","modified_gmt":"2024-10-31T03:34:53","slug":"things-about-bash","status":"publish","type":"post","link":"https:\/\/www.sudlatnid.com\/?p=2610","title":{"rendered":"Things about BASH"},"content":{"rendered":"\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<ol class=\"wp-block-list\">\n<li><strong>What is Bash<\/strong>\n<ul class=\"wp-block-list\">\n<li>Bash is a shell program that enables you to pass commands to the operating system (in this case Linux) and have them executed<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><h4 class=\"entry-title\"><strong>How does one check the version of the Bash shell<\/strong><\/h4>\n<ul class=\"wp-block-list\">\n<li><span style=\"color: initial;\">Checking the bash version helps Linux users in many cases, including troubleshooting and finding the currently available version in the system. If you are a regular bash user, it is good to check the bash version and keep it up to date as per the latest updates available. However, if you are a newbie in bash scripting, then you probably have never encountered a situation where you need to check the bash version.<\/span><\/li>\n\n\n\n<li>The Simple Approach\n<ul class=\"wp-block-list\">\n<li>The following command is the easiest way to know the bash version:<p style=\"box-sizing: border-box; border: 0px; font-size: 18.2858px; outline: 0px; padding: 0px; vertical-align: baseline; overflow-wrap: break-word; margin: 0px 0px 30px;\"><\/p>bash\u00a0&#8211;version<p style=\"box-sizing: border-box; border: 0px; font-size: 18.2858px; outline: 0px; padding: 0px; vertical-align: baseline; overflow-wrap: break-word; margin: 0px;\"><\/p><img fetchpriority=\"high\" decoding=\"async\" width=\"635\" height=\"146\" srcset=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2024\/05\/checking-bash-version.jpg 635w, https:\/\/linuxhint.com\/wp-content\/uploads\/2024\/05\/checking-bash-version-300x69.jpg 300w\" sizes=\"(max-width: 635px) 100vw, 635px\" class=\"aligncenter size-full wp-image-416480\" style=\"box-sizing: border-box; border-width: 0px; border-style: initial; vertical-align: middle; display: block; margin: 0px auto 30px;\" src=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2024\/05\/checking-bash-version.jpg\" alt=\"checking-bash-version\">From the above result, you can see the current bash version of the system is 5.2.21(1).Built in $BASH_VERSION variable<\/li>\n\n\n\n<li>Another method to check the bash\u2019s version is to enter the content of the bash shell\u2019s variable as follows:<p style=\"box-sizing: border-box; border: 0px; font-size: 16px; outline: 0px; padding: 0px; vertical-align: baseline; overflow-wrap: break-word; margin: 0px 0px 30px; color: rgb(68, 68, 68); font-family: Poppins; white-space-collapse: collapse; text-align: justify;\"><\/p>echo\u00a0$BASH_VERSION<p style=\"box-sizing: border-box; border: 0px; font-size: 16px; outline: 0px; padding: 0px; vertical-align: baseline; overflow-wrap: break-word; margin: 0px 0px 30px; color: rgb(68, 68, 68); font-family: Poppins; white-space-collapse: collapse;\"><\/p><img loading=\"lazy\" decoding=\"async\" width=\"631\" height=\"80\" data-lazy-srcset=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2024\/05\/echo-to-check-the-bash-version.jpg 631w, https:\/\/linuxhint.com\/wp-content\/uploads\/2024\/05\/echo-to-check-the-bash-version-300x38.jpg 300w\" data-lazy-sizes=\"(max-width: 631px) 100vw, 631px\" data-lazy-src=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2024\/05\/echo-to-check-the-bash-version.jpg\" data-ll-status=\"loaded\" sizes=\"auto, (max-width: 631px) 100vw, 631px\" srcset=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2024\/05\/echo-to-check-the-bash-version.jpg 631w, https:\/\/linuxhint.com\/wp-content\/uploads\/2024\/05\/echo-to-check-the-bash-version-300x38.jpg 300w\" class=\"aligncenter size-full wp-image-416481 entered lazyloaded\" style=\"box-sizing: border-box; border-width: 0px; border-style: initial; vertical-align: middle; display: block; margin: 0px auto 30px;\" src=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2024\/05\/echo-to-check-the-bash-version.jpg\" alt=\"echo-to-check-the-bash-version\">The Shell Script\n<ul class=\"wp-block-list\">\n<li>It is also possible to check the bash version through a shell script. First, create a new shell script using the nano command, create a new bash file named check-bash-version.sh, and make it executable using the chmod command:nano\u00a0~\/check-bash-version.shchmod\u00a0+x check-bash-version.sh<p style=\"box-sizing: border-box; border: 0px; font-size: 16px; outline: 0px; padding: 0px; vertical-align: baseline; overflow-wrap: break-word; margin: 0px 0px 30px; color: rgb(68, 68, 68); font-family: Poppins; white-space-collapse: collapse;\"><\/p>Next, add the following lines to your script:<p style=\"box-sizing: border-box; border: 0px; font-size: 16px; outline: 0px; padding: 0px; vertical-align: baseline; overflow-wrap: break-word; margin: 0px 0px 30px; color: rgb(68, 68, 68); font-family: Poppins; white-space-collapse: collapse; text-align: justify;\"><\/p>#!\/bin\/bash echo&#8221;Checking the bash version&#8230;.&#8221;echo\u00a0&#8220;The Bash version is\u00a0$BASH_VERSION\u00a0!&#8221;<p style=\"box-sizing: border-box; border: 0px; font-size: 16px; outline: 0px; padding: 0px; vertical-align: baseline; overflow-wrap: break-word; margin: 0px 0px 30px; color: rgb(68, 68, 68); font-family: Poppins; white-space-collapse: collapse;\"><\/p><img loading=\"lazy\" decoding=\"async\" width=\"616\" height=\"106\" data-lazy-srcset=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2024\/05\/shell-scripting-to-check-the-bash-version.jpg 616w, https:\/\/linuxhint.com\/wp-content\/uploads\/2024\/05\/shell-scripting-to-check-the-bash-version-300x52.jpg 300w\" data-lazy-sizes=\"(max-width: 616px) 100vw, 616px\" data-lazy-src=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2024\/05\/shell-scripting-to-check-the-bash-version.jpg\" data-ll-status=\"loaded\" sizes=\"auto, (max-width: 616px) 100vw, 616px\" srcset=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2024\/05\/shell-scripting-to-check-the-bash-version.jpg 616w, https:\/\/linuxhint.com\/wp-content\/uploads\/2024\/05\/shell-scripting-to-check-the-bash-version-300x52.jpg 300w\" class=\"aligncenter size-full wp-image-416483 entered lazyloaded\" style=\"box-sizing: border-box; border-width: 0px; border-style: initial; vertical-align: middle; display: block; margin: 0px auto 30px;\" src=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2024\/05\/shell-scripting-to-check-the-bash-version.jpg\" alt=\"shell-scripting-to-check-the-bash-version\">Now, check the bash version by running the script as follows:.\/check-bash-version.sh<p style=\"box-sizing: border-box; border: 0px; font-size: 16px; outline: 0px; padding: 0px; vertical-align: baseline; overflow-wrap: break-word; margin: 0px 0px 30px; color: rgb(68, 68, 68); font-family: Poppins; white-space-collapse: collapse;\"><\/p><img loading=\"lazy\" decoding=\"async\" width=\"607\" height=\"54\" data-lazy-srcset=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2024\/05\/executing-the-shell-scripting.jpg 607w, https:\/\/linuxhint.com\/wp-content\/uploads\/2024\/05\/executing-the-shell-scripting-300x27.jpg 300w\" data-lazy-sizes=\"(max-width: 607px) 100vw, 607px\" data-lazy-src=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2024\/05\/executing-the-shell-scripting.jpg\" data-ll-status=\"loaded\" sizes=\"auto, (max-width: 607px) 100vw, 607px\" srcset=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2024\/05\/executing-the-shell-scripting.jpg 607w, https:\/\/linuxhint.com\/wp-content\/uploads\/2024\/05\/executing-the-shell-scripting-300x27.jpg 300w\" class=\"aligncenter size-full wp-image-416484 entered lazyloaded\" style=\"box-sizing: border-box; border-width: 0px; border-style: initial; vertical-align: middle; display: block; margin: 0px auto 30px;\" src=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2024\/05\/executing-the-shell-scripting.jpg\" alt=\"executing-the-shell-scripting\">Using the Shortcut KeyMeanwhile, you can use the shortcut key \u2018 Ctrl+X followed by \u2018Ctrl+V\u2019, and you may see the bash version on your screen as seen in the below image:<img loading=\"lazy\" decoding=\"async\" width=\"609\" height=\"54\" data-lazy-srcset=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2024\/05\/key-board-shortcut-key.jpg 609w, https:\/\/linuxhint.com\/wp-content\/uploads\/2024\/05\/key-board-shortcut-key-300x27.jpg 300w\" data-lazy-sizes=\"(max-width: 609px) 100vw, 609px\" data-lazy-src=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2024\/05\/key-board-shortcut-key.jpg\" data-ll-status=\"loaded\" sizes=\"auto, (max-width: 609px) 100vw, 609px\" srcset=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2024\/05\/key-board-shortcut-key.jpg 609w, https:\/\/linuxhint.com\/wp-content\/uploads\/2024\/05\/key-board-shortcut-key-300x27.jpg 300w\" class=\"aligncenter size-full wp-image-416486 entered lazyloaded\" style=\"box-sizing: border-box; border-width: 0px; border-style: initial; vertical-align: middle; display: block; margin: 0px auto 30px;\" src=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2024\/05\/key-board-shortcut-key.jpg\" alt=\"key-board-shortcut-key\">From the Package Manager<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Through the package manager, you can simply run a single command to view the bash version.yum info\u00a0bash\u00a0(for\u00a0CentOS\/RHEL)pkg info\u00a0bash\u00a0(for\u00a0FreeBSD)apk info\u00a0bash\u00a0(for\u00a0Alpine Linux)apt info\u00a0bash\u00a0(for\u00a0Ubuntu)<p style=\"box-sizing: border-box; border: 0px; font-size: 16px; outline: 0px; padding: 0px; vertical-align: baseline; overflow-wrap: break-word; margin: 0px 0px 30px; color: rgb(68, 68, 68); font-family: Poppins; white-space-collapse: collapse;\"><\/p><img loading=\"lazy\" decoding=\"async\" width=\"629\" height=\"115\" data-lazy-srcset=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2024\/05\/apt-info-bash-scripting.jpg 629w, https:\/\/linuxhint.com\/wp-content\/uploads\/2024\/05\/apt-info-bash-scripting-300x55.jpg 300w\" data-lazy-sizes=\"(max-width: 629px) 100vw, 629px\" data-lazy-src=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2024\/05\/apt-info-bash-scripting.jpg\" data-ll-status=\"loaded\" sizes=\"auto, (max-width: 629px) 100vw, 629px\" srcset=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2024\/05\/apt-info-bash-scripting.jpg 629w, https:\/\/linuxhint.com\/wp-content\/uploads\/2024\/05\/apt-info-bash-scripting-300x55.jpg 300w\" class=\"aligncenter size-full wp-image-416485 entered lazyloaded\" style=\"box-sizing: border-box; border-width: 0px; border-style: initial; vertical-align: middle; display: block; margin: 0px auto 30px;\" src=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2024\/05\/apt-info-bash-scripting.jpg\" alt=\"apt-info-bash-scripting\"><br><br><\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\"><\/div><\/div>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[21],"tags":[],"class_list":["post-2610","post","type-post","status-publish","format-standard","hentry","category-linux-ubuntu-lubuntu-linuxmint","odd"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.sudlatnid.com\/index.php?rest_route=\/wp\/v2\/posts\/2610","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sudlatnid.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sudlatnid.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sudlatnid.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sudlatnid.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2610"}],"version-history":[{"count":2,"href":"https:\/\/www.sudlatnid.com\/index.php?rest_route=\/wp\/v2\/posts\/2610\/revisions"}],"predecessor-version":[{"id":2622,"href":"https:\/\/www.sudlatnid.com\/index.php?rest_route=\/wp\/v2\/posts\/2610\/revisions\/2622"}],"wp:attachment":[{"href":"https:\/\/www.sudlatnid.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2610"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sudlatnid.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2610"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sudlatnid.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2610"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}