{"id":12699,"date":"2024-11-13T05:19:51","date_gmt":"2024-11-13T05:19:51","guid":{"rendered":"https:\/\/greenwebpage.com\/community\/?p=12699"},"modified":"2024-11-13T05:50:27","modified_gmt":"2024-11-13T05:50:27","slug":"how-to-create-a-multiple-choice-menu-in-bash-scripts","status":"publish","type":"post","link":"https:\/\/greenwebpage.com\/community\/how-to-create-a-multiple-choice-menu-in-bash-scripts\/","title":{"rendered":"How to Create a Multiple Choice Menu in Bash Scripts: Using Select &amp; Case Statements"},"content":{"rendered":"\n<p>Bash is a command processor that typically runs in a text window, allowing the user to type commands that cause actions. Bash reads commands through the file, known as a script. Bash scripts are incredibly versatile and can be used to automate a wide range of tasks. One particularly useful feature is the ability to create a multiple choice menu, which can make your scripts more interactive and user-friendly.<\/p>\n\n\n\n<p>In this blog post, we&#8217;ll explore how to create a multiple choice menu in Bash scripts, which can be a great addition to any developer&#8217;s toolkit.<\/p>\n\n\n\n<p><strong>Table of Content<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"#How-to-Create-a-Multiple-Choice-Menu-in-Bash-Scripts\">How to Create a Multiple Choice Menu in Bash Scripts <\/a>\n<ul class=\"wp-block-list\">\n<li><a href=\"#Create-a-Bash-Script\">Create a Bash Script <\/a><\/li>\n\n\n\n<li><a href=\"#Setting-Up-the-Input-Prompt\">Setting Up the Input Prompt<\/a><\/li>\n\n\n\n<li><a href=\"#Creating-Your-List-of-Options\">Creating Your List of Options<\/a><\/li>\n\n\n\n<li><a href=\"#Crafting-the-Menu-with-select\">Crafting the Menu with select<\/a><\/li>\n\n\n\n<li><a href=\"#Implementing-case-Statements\">Implementing case Statements<\/a><\/li>\n\n\n\n<li><a href=\"#Make-the-Script-Executable\">Make the Script Executable<\/a><\/li>\n\n\n\n<li><a href=\"#Run-the-Script\">Run the Script<\/a><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><a href=\"#Conclusion\">Conclusion<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"How-to-Create-a-Multiple-Choice-Menu-in-Bash-Scripts\"><a id=\"post-12699-_ze2u33gvl6d6\"><\/a>How to Create a Multiple Choice Menu in Bash Scripts<\/h2>\n\n\n\n<p>Before diving into the creation of a multiple choice menu, it&#8217;s important to understand some basic concepts. To create a multiple choice menu in Bash, we primarily use two constructs. <strong>select<\/strong> is the core command for creating the menu itself. <strong>case<\/strong> handle the user&#8217;s choice.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"Create-a-Bash-Script\"><a id=\"post-12699-_a5jkadj73ce7\"><\/a>Create a Bash Script<\/h3>\n\n\n\n<p>Create a new file with a .sh extension (e.g., <strong>menu.sh<\/strong>). Open it in a text editor such as <strong>nano<\/strong>:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1239\" height=\"146\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2024\/11\/word-image-12699-1.png\" alt=\"\" class=\"wp-image-12700\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2024\/11\/word-image-12699-1.png 1239w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2024\/11\/word-image-12699-1-300x35.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2024\/11\/word-image-12699-1-1024x121.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2024\/11\/word-image-12699-1-768x90.png 768w\" sizes=\"(max-width: 1239px) 100vw, 1239px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"Setting-Up-the-Input-Prompt\"><a id=\"post-12699-_juobw6l62wmh\"><\/a>Setting Up the Input Prompt<\/h3>\n\n\n\n<p>The first step in creating a multiple choice menu is to set up the input prompt. This is done using the PS3 variable, which defines the prompt string displayed to the user when the select command is used. For example:<\/p>\n\n\n\n<pre>PS3='Please select an option: '<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"Creating-Your-List-of-Options\"><a id=\"post-12699-_aoofyym8bkdh\"><\/a>Creating Your List of Options<\/h3>\n\n\n\n<p>Next, you&#8217;ll need to create an array of options for the user to choose from. This is done by defining an array variable with the list of choices. Let\u2019s create an array to carry different menu options as below:<\/p>\n\n\n\n<pre>#!\/bin\/bash <br>options=(\"Option 1\" \"Option 2\" \"Option 3\" \"Quit\")<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"Crafting-the-Menu-with-select\"><a id=\"post-12699-_plynck2ylsar\"><\/a>Crafting the Menu with select<\/h3>\n\n\n\n<p>Use the select loop to display the menu and capture the user&#8217;s choice. The <strong>select <\/strong>construct is used to generate the menu. It takes the list of options and generates a menu from them. Here&#8217;s how you can use <strong>select <\/strong>to create your menu:<\/p>\n\n\n\n<pre>select opt in \"${options[@]}\" <br>do <br># Your code goes here <br>done<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"Implementing-case-Statements\"><a id=\"post-12699-_dkqss1rxs2dh\"><\/a>Implementing case Statements<\/h3>\n\n\n\n<p>To handle the user&#8217;s selection, <strong>case statements <\/strong>are used. These allow you to execute different pieces of code based on the user&#8217;s input. Here&#8217;s an example of how <strong>case statements <\/strong>can be used within the select construct:<\/p>\n\n\n\n<pre>select opt in \"${options[@]}\" <br>do <br>case $opt in <br>\"Option 1\") <br>echo \"You chose option 1\" <br>;; <br>\"Option 2\") <br>echo \"You chose option 2\" <br>;; <br>\"Option 3\") <br>echo \"You chose option 3\" <br>;; <br>\"Quit\") <br>break <br>;; <br>*) <br>echo \"Invalid option $REPLY\" <br>;; <br>esac <br>done<\/pre>\n\n\n\n<p><strong>Code Description:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>First, evaluates the user&#8217;s choice <strong>($opt<\/strong>) and performs actions based on the selected option.<\/li>\n\n\n\n<li>Then, <strong>Option 1<\/strong>, <strong>2<\/strong>, or <strong>3 <\/strong>prints a confirmation message.<\/li>\n\n\n\n<li>After that, <strong>Quit<\/strong> exits the program.<\/li>\n\n\n\n<li>Finally, the <strong>invalid option<\/strong> displays an error message with the selected option.<\/li>\n<\/ul>\n\n\n\n<p><strong>Complete Code<\/strong><\/p>\n\n\n\n<p>Now that we&#8217;ve covered the individual components, let&#8217;s put everything together into a complete script:<\/p>\n\n\n\n<pre>#!\/bin\/bash <br><br># Set up the input prompt <br>PS3='Please select an option: ' <br><br># Create the list of options <br>options=(\"Option 1\" \"Option 2\" \"Option 3\" \"Quit\") <br><br># Generate the menu and handle user input <br>select opt in \"${options[@]}\" <br>do <br>case $opt in <br>\"Option 1\") <br>echo \"You chose option 1\" <br>;; <br>\"Option 2\") <br>echo \"You chose option 2\" <br>;; <br>\"Option 3\") <br>echo \"You chose option 3\" <br>;; <br>\"Quit\") <br>break <br>;; <br>*) <br>echo \"Invalid option $REPLY\" <br>;; <br>esac <br>done<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"1240\" height=\"891\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2024\/11\/word-image-12699-2.png\" alt=\"\" class=\"wp-image-12701\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2024\/11\/word-image-12699-2.png 1240w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2024\/11\/word-image-12699-2-300x216.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2024\/11\/word-image-12699-2-1024x736.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2024\/11\/word-image-12699-2-768x552.png 768w\" sizes=\"(max-width: 1240px) 100vw, 1240px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>Code Description<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>First, the <strong>PS3<\/strong> sets the prompt for the menu.<\/li>\n\n\n\n<li>Then, <strong>select opt in &#8220;${options[@]}&#8221; <\/strong>and create a menu with the options from the array.<\/li>\n\n\n\n<li>After that, <strong>case $opt in<\/strong> checks the user&#8217;s choice and executes corresponding code.<\/li>\n\n\n\n<li>In addition, <strong>break<\/strong> exits the loop when &#8220;<strong>Quit<\/strong>&#8221; is selected.<\/li>\n\n\n\n<li>Finally, <strong>*) <\/strong>handles invalid choices.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"Make-the-Script-Executable\"><a id=\"post-12699-_lgepiwd1kr0\"><\/a>Make the Script Executable<\/h3>\n\n\n\n<p>The code <strong>chmod +x menu.sh <\/strong>is a command in the Bash shell used to change the permissions of a file named menu.sh. <strong>+x <\/strong>is an option for the chmod command. Here, the + symbol signifies adding permissions, and x represents the execute permission.<\/p>\n\n\n\n<pre>chmod +x menu.sh<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"1234\" height=\"120\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2024\/11\/word-image-12699-3.png\" alt=\"\" class=\"wp-image-12702\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2024\/11\/word-image-12699-3.png 1234w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2024\/11\/word-image-12699-3-300x29.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2024\/11\/word-image-12699-3-1024x100.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2024\/11\/word-image-12699-3-768x75.png 768w\" sizes=\"(max-width: 1234px) 100vw, 1234px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>So, combining these parts, chmod +x menu.sh instructs the system to add the execute permission to the file <strong>menu.sh<\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"Run-the-Script\"><a id=\"post-12699-_wv0isp9adtki\"><\/a>Run the Script<\/h3>\n\n\n\n<p>This script provides a basic structure for creating a user-friendly, interactive menu in your Bash scripts. The code in the script <strong>.\/menu.sh<\/strong> creates a text-based multiple choice menu for the user:<\/p>\n\n\n\n<pre>.\/menu.sh<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1244\" height=\"483\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2024\/11\/word-image-12699-4.png\" alt=\"\" class=\"wp-image-12703\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2024\/11\/word-image-12699-4.png 1244w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2024\/11\/word-image-12699-4-300x116.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2024\/11\/word-image-12699-4-1024x398.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2024\/11\/word-image-12699-4-768x298.png 768w\" sizes=\"(max-width: 1244px) 100vw, 1244px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>This script displays a menu with three options and a quit option. When the user selects an option, the corresponding message is displayed. When the user selects &#8220;<strong>Quit<\/strong>&#8220;, the <strong>break <\/strong>statement exits the select loop, effectively terminating the script.<\/p>\n\n\n\n<p>By following these steps and incorporating the provided code, you can effectively create multiple choice menus in your Bash scripts.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"Conclusion\"><a id=\"post-12699-_udbn9uo87vak\"><\/a>Conclusion<\/h2>\n\n\n\n<p>Creating a multiple choice menu in Bash scripts is a straightforward process that can greatly enhance the interactivity and user-friendliness of your scripts. By following the steps outlined in this post, you can easily implement such menus in your own Bash scripts. For more detailed examples and advanced usage, you can refer to online resources and tutorials that provide in-depth explanations and additional context.<\/p>\n\n\n\t\t\t\t\t\t\t<h3 style=\"margin-bottom:20px;display:block;width:100%;margin-top:10px\">Frequently Asked Questions <\/h3>\r\n\t\t\t\t\t\t<style>\r\n\t\t\t\t<style>\r\n#wpsm_accordion_12708 .wpsm_panel-heading{\r\n\tpadding:0px !important;\r\n}\r\n#wpsm_accordion_12708 .wpsm_panel-title {\r\n\tmargin:0px !important; \r\n\ttext-transform:none !important;\r\n\tline-height: 1 !important;\r\n}\r\n#wpsm_accordion_12708 .wpsm_panel-title a{\r\n\ttext-decoration:none;\r\n\toverflow:hidden;\r\n\tdisplay:block;\r\n\tpadding:0px;\r\n\tfont-size: 18px !important;\r\n\tfont-family: Open Sans !important;\r\n\tcolor:#000000 !important;\r\n\tborder-bottom:0px !important;\r\n}\r\n\r\n#wpsm_accordion_12708 .wpsm_panel-title a:focus {\r\noutline: 0px !important;\r\n}\r\n\r\n#wpsm_accordion_12708 .wpsm_panel-title a:hover, #wpsm_accordion_12708 .wpsm_panel-title a:focus {\r\n\tcolor:#000000 !important;\r\n}\r\n#wpsm_accordion_12708 .acc-a{\r\n\tcolor: #000000 !important;\r\n\tbackground-color:#e8e8e8 !important;\r\n\tborder-color: #ddd;\r\n}\r\n#wpsm_accordion_12708 .wpsm_panel-default > .wpsm_panel-heading{\r\n\tcolor: #000000 !important;\r\n\tbackground-color: #e8e8e8 !important;\r\n\tborder-color: #e8e8e8 !important;\r\n\tborder-top-left-radius: 0px;\r\n\tborder-top-right-radius: 0px;\r\n}\r\n#wpsm_accordion_12708 .wpsm_panel-default {\r\n\t\tborder:1px solid transparent !important;\r\n\t}\r\n#wpsm_accordion_12708 {\r\n\tmargin-bottom: 20px;\r\n\toverflow: hidden;\r\n\tfloat: none;\r\n\twidth: 100%;\r\n\tdisplay: block;\r\n}\r\n#wpsm_accordion_12708 .ac_title_class{\r\n\tdisplay: block;\r\n\tpadding-top: 12px;\r\n\tpadding-bottom: 12px;\r\n\tpadding-left: 15px;\r\n\tpadding-right: 15px;\r\n}\r\n#wpsm_accordion_12708  .wpsm_panel {\r\n\toverflow:hidden;\r\n\t-webkit-box-shadow: 0 0px 0px rgba(0, 0, 0, .05);\r\n\tbox-shadow: 0 0px 0px rgba(0, 0, 0, .05);\r\n\t\tborder-radius: 4px;\r\n\t}\r\n#wpsm_accordion_12708  .wpsm_panel + .wpsm_panel {\r\n\t\tmargin-top: 5px;\r\n\t}\r\n#wpsm_accordion_12708  .wpsm_panel-body{\r\n\tbackground-color:#ffffff !important;\r\n\tcolor:#000000 !important;\r\n\tborder-top-color: #e8e8e8 !important;\r\n\tfont-size:16px !important;\r\n\tfont-family: Open Sans !important;\r\n\toverflow: hidden;\r\n\t\tborder: 2px solid #e8e8e8 !important;\r\n\t}\r\n\r\n#wpsm_accordion_12708 .ac_open_cl_icon{\r\n\tbackground-color:#e8e8e8 !important;\r\n\tcolor: #000000 !important;\r\n\tfloat:right !important;\r\n\tpadding-top: 12px !important;\r\n\tpadding-bottom: 12px !important;\r\n\tline-height: 1.0 !important;\r\n\tpadding-left: 15px !important;\r\n\tpadding-right: 15px !important;\r\n\tdisplay: inline-block !important;\r\n}\r\n\r\n\t\t\t\r\n\t\t\t<\/style>\t\r\n\t\t\t<\/style>\r\n\t\t\t<div class=\"wpsm_panel-group\" id=\"wpsm_accordion_12708\" >\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t<!-- Inner panel Start -->\r\n\t\t\t\t\t<div class=\"wpsm_panel wpsm_panel-default\">\r\n\t\t\t\t\t\t<div class=\"wpsm_panel-heading\" role=\"tab\" >\r\n\t\t\t\t\t\t  <h4 class=\"wpsm_panel-title\">\r\n\t\t\t\t\t\t\t<a  class=\"\"  data-toggle=\"collapse\" data-parent=\"#wpsm_accordion_12708 \" href=\"javascript:void(0)\" data-target=\"#ac_12708_collapse1\" onclick=\"do_resize()\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"ac_open_cl_icon fa fa-plus\"><\/span>\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t<span class=\"ac_title_class\">\r\n\t\t\t\t\t\t\t\t\tHow do I create a basic multiple-choice menu in a Bash script?\t\t\t\t\t\t\t\t<\/span>\r\n\t\t\t\t\t\t\t<\/a>\r\n\t\t\t\t\t\t  <\/h4>\r\n\t\t\t\t\t\t<\/div>\r\n\t\t\t\t\t\t<div id=\"ac_12708_collapse1\" class=\"wpsm_panel-collapse collapse \"  >\r\n\t\t\t\t\t\t  <div class=\"wpsm_panel-body\">\r\n\t\t\t\t\t\t\tA simple way to create a multiple-choice menu in Bash is by using a select loop. Here's a basic example:\r\n#!\/bin\/bash\r\n\r\nPS3=\"Please select an option: \"  # Prompt for the menu\r\nselect option in \"Option 1\" \"Option 2\" \"Option 3\" \"Quit\"\r\ndo\r\n    case $option in\r\n        \"Option 1\")\r\n            echo \"You chose Option 1.\"\r\n            ;;\r\n        \"Option 2\")\r\n            echo \"You chose Option 2.\"\r\n            ;;\r\n        \"Option 3\")\r\n            echo \"You chose Option 3.\"\r\n            ;;\r\n        \"Quit\")\r\n            echo \"Exiting...\"\r\n            break\r\n            ;;\r\n        *)\r\n            echo \"Invalid option. Please try again.\"\r\n            ;;\r\n    esac\r\ndone\r\n\r\n\t\t\t\t\t\t  <\/div>\r\n\t\t\t\t\t\t<\/div>\r\n\t\t\t\t\t<\/div>\r\n\t\t\t\t\t<!-- Inner panel End -->\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t<!-- Inner panel Start -->\r\n\t\t\t\t\t<div class=\"wpsm_panel wpsm_panel-default\">\r\n\t\t\t\t\t\t<div class=\"wpsm_panel-heading\" role=\"tab\" >\r\n\t\t\t\t\t\t  <h4 class=\"wpsm_panel-title\">\r\n\t\t\t\t\t\t\t<a  class=\"collapsed\"  data-toggle=\"collapse\" data-parent=\"#wpsm_accordion_12708 \" href=\"javascript:void(0)\" data-target=\"#ac_12708_collapse2\" onclick=\"do_resize()\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"ac_open_cl_icon fa fa-plus\"><\/span>\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t<span class=\"ac_title_class\">\r\n\t\t\t\t\t\t\t\t\tCan I display a custom prompt for the menu?\t\t\t\t\t\t\t\t<\/span>\r\n\t\t\t\t\t\t\t<\/a>\r\n\t\t\t\t\t\t  <\/h4>\r\n\t\t\t\t\t\t<\/div>\r\n\t\t\t\t\t\t<div id=\"ac_12708_collapse2\" class=\"wpsm_panel-collapse collapse \"  >\r\n\t\t\t\t\t\t  <div class=\"wpsm_panel-body\">\r\n\t\t\t\t\t\t\tYes, you can customize the prompt by modifying the PS3 variable. For example:\r\n\r\nPS3=\"Please choose a valid option: \"\r\n\r\nThis sets the prompt to a custom message when the select statement is used.\t\t\t\t\t\t  <\/div>\r\n\t\t\t\t\t\t<\/div>\r\n\t\t\t\t\t<\/div>\r\n\t\t\t\t\t<!-- Inner panel End -->\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t<!-- Inner panel Start -->\r\n\t\t\t\t\t<div class=\"wpsm_panel wpsm_panel-default\">\r\n\t\t\t\t\t\t<div class=\"wpsm_panel-heading\" role=\"tab\" >\r\n\t\t\t\t\t\t  <h4 class=\"wpsm_panel-title\">\r\n\t\t\t\t\t\t\t<a  class=\"collapsed\"  data-toggle=\"collapse\" data-parent=\"#wpsm_accordion_12708 \" href=\"javascript:void(0)\" data-target=\"#ac_12708_collapse3\" onclick=\"do_resize()\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"ac_open_cl_icon fa fa-plus\"><\/span>\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t<span class=\"ac_title_class\">\r\n\t\t\t\t\t\t\t\t\tHow do I handle invalid input in the menu?\t\t\t\t\t\t\t\t<\/span>\r\n\t\t\t\t\t\t\t<\/a>\r\n\t\t\t\t\t\t  <\/h4>\r\n\t\t\t\t\t\t<\/div>\r\n\t\t\t\t\t\t<div id=\"ac_12708_collapse3\" class=\"wpsm_panel-collapse collapse \"  >\r\n\t\t\t\t\t\t  <div class=\"wpsm_panel-body\">\r\n\t\t\t\t\t\t\tYou can use the * case in a case statement to catch invalid selections and ask the user to try again. For instance:\r\n\r\ncase $option in\r\n    \"Option 1\")\r\n        echo \"You chose Option 1.\"\r\n        ;;\r\n    \"Option 2\")\r\n        echo \"You chose Option 2.\"\r\n        ;;\r\n    \"Quit\")\r\n        echo \"Exiting...\"\r\n        break\r\n        ;;\r\n    *)\r\n        echo \"Invalid choice. Please select a valid option.\"\r\n        ;;\r\nesac\r\n\t\t\t\t\t\t  <\/div>\r\n\t\t\t\t\t\t<\/div>\r\n\t\t\t\t\t<\/div>\r\n\t\t\t\t\t<!-- Inner panel End -->\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t<!-- Inner panel Start -->\r\n\t\t\t\t\t<div class=\"wpsm_panel wpsm_panel-default\">\r\n\t\t\t\t\t\t<div class=\"wpsm_panel-heading\" role=\"tab\" >\r\n\t\t\t\t\t\t  <h4 class=\"wpsm_panel-title\">\r\n\t\t\t\t\t\t\t<a  class=\"collapsed\"  data-toggle=\"collapse\" data-parent=\"#wpsm_accordion_12708 \" href=\"javascript:void(0)\" data-target=\"#ac_12708_collapse4\" onclick=\"do_resize()\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"ac_open_cl_icon fa fa-plus\"><\/span>\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t<span class=\"ac_title_class\">\r\n\t\t\t\t\t\t\t\t\tHow do I loop until the user selects a valid option?\t\t\t\t\t\t\t\t<\/span>\r\n\t\t\t\t\t\t\t<\/a>\r\n\t\t\t\t\t\t  <\/h4>\r\n\t\t\t\t\t\t<\/div>\r\n\t\t\t\t\t\t<div id=\"ac_12708_collapse4\" class=\"wpsm_panel-collapse collapse \"  >\r\n\t\t\t\t\t\t  <div class=\"wpsm_panel-body\">\r\n\t\t\t\t\t\t\tYou can use a while or until loop to continue prompting the user until they make a valid selection. For example:\r\n#!\/bin\/bash\r\n\r\nPS3=\"Please select an option: \"\r\nselect option in \"Option 1\" \"Option 2\" \"Quit\"\r\ndo\r\n    if [[ -n $option ]]; then\r\n        case $option in\r\n            \"Option 1\")\r\n                echo \"You chose Option 1.\"\r\n                break\r\n                ;;\r\n            \"Option 2\")\r\n                echo \"You chose Option 2.\"\r\n                break\r\n                ;;\r\n            \"Quit\")\r\n                echo \"Exiting...\"\r\n                break\r\n                ;;\r\n            *)\r\n                echo \"Invalid choice. Try again.\"\r\n                ;;\r\n        esac\r\n    else\r\n        echo \"Invalid input. Please choose a valid option.\"\r\n    fi\r\ndone\t\t\t\t\t\t  <\/div>\r\n\t\t\t\t\t\t<\/div>\r\n\t\t\t\t\t<\/div>\r\n\t\t\t\t\t<!-- Inner panel End -->\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t<!-- Inner panel Start -->\r\n\t\t\t\t\t<div class=\"wpsm_panel wpsm_panel-default\">\r\n\t\t\t\t\t\t<div class=\"wpsm_panel-heading\" role=\"tab\" >\r\n\t\t\t\t\t\t  <h4 class=\"wpsm_panel-title\">\r\n\t\t\t\t\t\t\t<a  class=\"collapsed\"  data-toggle=\"collapse\" data-parent=\"#wpsm_accordion_12708 \" href=\"javascript:void(0)\" data-target=\"#ac_12708_collapse5\" onclick=\"do_resize()\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"ac_open_cl_icon fa fa-plus\"><\/span>\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t<span class=\"ac_title_class\">\r\n\t\t\t\t\t\t\t\t\tHow do I create a menu that does something other than printing text?\t\t\t\t\t\t\t\t<\/span>\r\n\t\t\t\t\t\t\t<\/a>\r\n\t\t\t\t\t\t  <\/h4>\r\n\t\t\t\t\t\t<\/div>\r\n\t\t\t\t\t\t<div id=\"ac_12708_collapse5\" class=\"wpsm_panel-collapse collapse \"  >\r\n\t\t\t\t\t\t  <div class=\"wpsm_panel-body\">\r\n\t\t\t\t\t\t\tYou can execute commands or run functions inside the case or if statements for each menu option. For example:\r\n#!\/bin\/bash\r\n\r\nPS3=\"Choose an option: \"\r\nselect option in \"Check Disk Usage\" \"Show Running Processes\" \"Quit\"\r\ndo\r\n    case $option in\r\n        \"Check Disk Usage\")\r\n            df -h\r\n            ;;\r\n        \"Show Running Processes\")\r\n            ps aux\r\n            ;;\r\n        \"Quit\")\r\n            echo \"Exiting...\"\r\n            break\r\n            ;;\r\n        *)\r\n            echo \"Invalid option. Please try again.\"\r\n            ;;\r\n    esac\r\ndone\r\n\t\t\t\t\t\t  <\/div>\r\n\t\t\t\t\t\t<\/div>\r\n\t\t\t\t\t<\/div>\r\n\t\t\t\t\t<!-- Inner panel End -->\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\t<\/div>\r\n\t\t\t\r\n<script type=\"text\/javascript\">\r\n\t\r\n\t\tfunction do_resize(){\r\n\r\n\t\t\tvar width=jQuery( '.wpsm_panel .wpsm_panel-body iframe' ).width();\r\n\t\t\tvar height=jQuery( '.wpsm_panel .wpsm_panel-body iframe' ).height();\r\n\r\n\t\t\tvar toggleSize = true;\r\n\t\t\tjQuery('iframe').animate({\r\n\t\t\t    width: toggleSize ? width : 640,\r\n\t\t\t    height: toggleSize ? height : 360\r\n\t\t\t  }, 250);\r\n\r\n\t\t\t  toggleSize = !toggleSize;\r\n\t\t}\r\n\t\t\r\n<\/script>\t\n\n\n\n<p><\/p>\n\n    <div class=\"xs_social_share_widget xs_share_url after_content \t\tmain_content  wslu-style-1 wslu-share-box-shaped wslu-fill-colored wslu-none wslu-share-horizontal wslu-theme-font-no wslu-main_content\">\n\n\t\t\n        <ul>\n\t\t\t        <\/ul>\n    <\/div> \n","protected":false},"excerpt":{"rendered":"<p>Bash is a command processor that typically runs in a text window, allowing the user to type commands that cause actions. Bash reads commands through the file, known as a script. Bash scripts are incredibly versatile and can be used to automate a wide range of tasks. One particularly useful feature is the ability to [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":12707,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[43],"tags":[497,230,403,496],"class_list":["post-12699","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-bash-script","tag-linux","tag-linux-administration","tag-multiple-choice-menu"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Create a Multiple Choice Menu in Bash Scripts: Using Select &amp; Case Statements - Greenwebpage Community<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/greenwebpage.com\/community\/how-to-create-a-multiple-choice-menu-in-bash-scripts\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Create a Multiple Choice Menu in Bash Scripts: Using Select &amp; Case Statements - Greenwebpage Community\" \/>\n<meta property=\"og:description\" content=\"Bash is a command processor that typically runs in a text window, allowing the user to type commands that cause actions. Bash reads commands through the file, known as a script. Bash scripts are incredibly versatile and can be used to automate a wide range of tasks. One particularly useful feature is the ability to [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/greenwebpage.com\/community\/how-to-create-a-multiple-choice-menu-in-bash-scripts\/\" \/>\n<meta property=\"og:site_name\" content=\"Greenwebpage Community\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-13T05:19:51+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-13T05:50:27+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2024\/11\/Create-Multiple-Choice-Menu-in-Bash-Scripts.jpeg\" \/>\n\t<meta property=\"og:image:width\" content=\"1020\" \/>\n\t<meta property=\"og:image:height\" content=\"600\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Karim Buzdar\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Karim Buzdar\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/greenwebpage.com\/community\/how-to-create-a-multiple-choice-menu-in-bash-scripts\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/greenwebpage.com\/community\/how-to-create-a-multiple-choice-menu-in-bash-scripts\/\"},\"author\":{\"name\":\"Karim Buzdar\",\"@id\":\"https:\/\/greenwebpage.com\/community\/#\/schema\/person\/467c100c1d017bc081473ee0440680c8\"},\"headline\":\"How to Create a Multiple Choice Menu in Bash Scripts: Using Select &amp; Case Statements\",\"datePublished\":\"2024-11-13T05:19:51+00:00\",\"dateModified\":\"2024-11-13T05:50:27+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/greenwebpage.com\/community\/how-to-create-a-multiple-choice-menu-in-bash-scripts\/\"},\"wordCount\":768,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/greenwebpage.com\/community\/#organization\"},\"image\":{\"@id\":\"https:\/\/greenwebpage.com\/community\/how-to-create-a-multiple-choice-menu-in-bash-scripts\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2024\/11\/Create-Multiple-Choice-Menu-in-Bash-Scripts.jpeg\",\"keywords\":[\"Bash Script\",\"Linux\",\"Linux Administration\",\"Multiple Choice Menu\"],\"articleSection\":[\"Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/greenwebpage.com\/community\/how-to-create-a-multiple-choice-menu-in-bash-scripts\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/greenwebpage.com\/community\/how-to-create-a-multiple-choice-menu-in-bash-scripts\/\",\"url\":\"https:\/\/greenwebpage.com\/community\/how-to-create-a-multiple-choice-menu-in-bash-scripts\/\",\"name\":\"How to Create a Multiple Choice Menu in Bash Scripts: Using Select &amp; Case Statements - Greenwebpage Community\",\"isPartOf\":{\"@id\":\"https:\/\/greenwebpage.com\/community\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/greenwebpage.com\/community\/how-to-create-a-multiple-choice-menu-in-bash-scripts\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/greenwebpage.com\/community\/how-to-create-a-multiple-choice-menu-in-bash-scripts\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2024\/11\/Create-Multiple-Choice-Menu-in-Bash-Scripts.jpeg\",\"datePublished\":\"2024-11-13T05:19:51+00:00\",\"dateModified\":\"2024-11-13T05:50:27+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/greenwebpage.com\/community\/how-to-create-a-multiple-choice-menu-in-bash-scripts\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/greenwebpage.com\/community\/how-to-create-a-multiple-choice-menu-in-bash-scripts\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/greenwebpage.com\/community\/how-to-create-a-multiple-choice-menu-in-bash-scripts\/#primaryimage\",\"url\":\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2024\/11\/Create-Multiple-Choice-Menu-in-Bash-Scripts.jpeg\",\"contentUrl\":\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2024\/11\/Create-Multiple-Choice-Menu-in-Bash-Scripts.jpeg\",\"width\":1020,\"height\":600,\"caption\":\"Create Multiple Choice Menu in Bash Scripts\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/greenwebpage.com\/community\/how-to-create-a-multiple-choice-menu-in-bash-scripts\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/greenwebpage.com\/community\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Create a Multiple Choice Menu in Bash Scripts: Using Select &amp; Case Statements\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/greenwebpage.com\/community\/#website\",\"url\":\"https:\/\/greenwebpage.com\/community\/\",\"name\":\"Greenwebpage Community\",\"description\":\"Get online in three steps with our wide range of web hosting solutions. Choose from professional business to enterprise options designed to meet your needs.\",\"publisher\":{\"@id\":\"https:\/\/greenwebpage.com\/community\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/greenwebpage.com\/community\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/greenwebpage.com\/community\/#organization\",\"name\":\"Greenwebpage Community\",\"url\":\"https:\/\/greenwebpage.com\/community\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/greenwebpage.com\/community\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2023\/10\/cropped-logomic.png\",\"contentUrl\":\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2023\/10\/cropped-logomic.png\",\"width\":512,\"height\":512,\"caption\":\"Greenwebpage Community\"},\"image\":{\"@id\":\"https:\/\/greenwebpage.com\/community\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/greenwebpage.com\/community\/#\/schema\/person\/467c100c1d017bc081473ee0440680c8\",\"name\":\"Karim Buzdar\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/greenwebpage.com\/community\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/0628fcbcddd9bc5486245d2cf4a904dbcdeac9ad6c3098f49237094e9d513d0c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/0628fcbcddd9bc5486245d2cf4a904dbcdeac9ad6c3098f49237094e9d513d0c?s=96&d=mm&r=g\",\"caption\":\"Karim Buzdar\"},\"sameAs\":[\"https:\/\/greenwebpage.com\"],\"url\":\"https:\/\/greenwebpage.com\/community\/author\/karim\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Create a Multiple Choice Menu in Bash Scripts: Using Select &amp; Case Statements - Greenwebpage Community","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/greenwebpage.com\/community\/how-to-create-a-multiple-choice-menu-in-bash-scripts\/","og_locale":"en_US","og_type":"article","og_title":"How to Create a Multiple Choice Menu in Bash Scripts: Using Select &amp; Case Statements - Greenwebpage Community","og_description":"Bash is a command processor that typically runs in a text window, allowing the user to type commands that cause actions. Bash reads commands through the file, known as a script. Bash scripts are incredibly versatile and can be used to automate a wide range of tasks. One particularly useful feature is the ability to [&hellip;]","og_url":"https:\/\/greenwebpage.com\/community\/how-to-create-a-multiple-choice-menu-in-bash-scripts\/","og_site_name":"Greenwebpage Community","article_published_time":"2024-11-13T05:19:51+00:00","article_modified_time":"2024-11-13T05:50:27+00:00","og_image":[{"width":1020,"height":600,"url":"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2024\/11\/Create-Multiple-Choice-Menu-in-Bash-Scripts.jpeg","type":"image\/jpeg"}],"author":"Karim Buzdar","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Karim Buzdar","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/greenwebpage.com\/community\/how-to-create-a-multiple-choice-menu-in-bash-scripts\/#article","isPartOf":{"@id":"https:\/\/greenwebpage.com\/community\/how-to-create-a-multiple-choice-menu-in-bash-scripts\/"},"author":{"name":"Karim Buzdar","@id":"https:\/\/greenwebpage.com\/community\/#\/schema\/person\/467c100c1d017bc081473ee0440680c8"},"headline":"How to Create a Multiple Choice Menu in Bash Scripts: Using Select &amp; Case Statements","datePublished":"2024-11-13T05:19:51+00:00","dateModified":"2024-11-13T05:50:27+00:00","mainEntityOfPage":{"@id":"https:\/\/greenwebpage.com\/community\/how-to-create-a-multiple-choice-menu-in-bash-scripts\/"},"wordCount":768,"commentCount":0,"publisher":{"@id":"https:\/\/greenwebpage.com\/community\/#organization"},"image":{"@id":"https:\/\/greenwebpage.com\/community\/how-to-create-a-multiple-choice-menu-in-bash-scripts\/#primaryimage"},"thumbnailUrl":"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2024\/11\/Create-Multiple-Choice-Menu-in-Bash-Scripts.jpeg","keywords":["Bash Script","Linux","Linux Administration","Multiple Choice Menu"],"articleSection":["Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/greenwebpage.com\/community\/how-to-create-a-multiple-choice-menu-in-bash-scripts\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/greenwebpage.com\/community\/how-to-create-a-multiple-choice-menu-in-bash-scripts\/","url":"https:\/\/greenwebpage.com\/community\/how-to-create-a-multiple-choice-menu-in-bash-scripts\/","name":"How to Create a Multiple Choice Menu in Bash Scripts: Using Select &amp; Case Statements - Greenwebpage Community","isPartOf":{"@id":"https:\/\/greenwebpage.com\/community\/#website"},"primaryImageOfPage":{"@id":"https:\/\/greenwebpage.com\/community\/how-to-create-a-multiple-choice-menu-in-bash-scripts\/#primaryimage"},"image":{"@id":"https:\/\/greenwebpage.com\/community\/how-to-create-a-multiple-choice-menu-in-bash-scripts\/#primaryimage"},"thumbnailUrl":"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2024\/11\/Create-Multiple-Choice-Menu-in-Bash-Scripts.jpeg","datePublished":"2024-11-13T05:19:51+00:00","dateModified":"2024-11-13T05:50:27+00:00","breadcrumb":{"@id":"https:\/\/greenwebpage.com\/community\/how-to-create-a-multiple-choice-menu-in-bash-scripts\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/greenwebpage.com\/community\/how-to-create-a-multiple-choice-menu-in-bash-scripts\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/greenwebpage.com\/community\/how-to-create-a-multiple-choice-menu-in-bash-scripts\/#primaryimage","url":"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2024\/11\/Create-Multiple-Choice-Menu-in-Bash-Scripts.jpeg","contentUrl":"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2024\/11\/Create-Multiple-Choice-Menu-in-Bash-Scripts.jpeg","width":1020,"height":600,"caption":"Create Multiple Choice Menu in Bash Scripts"},{"@type":"BreadcrumbList","@id":"https:\/\/greenwebpage.com\/community\/how-to-create-a-multiple-choice-menu-in-bash-scripts\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/greenwebpage.com\/community\/"},{"@type":"ListItem","position":2,"name":"How to Create a Multiple Choice Menu in Bash Scripts: Using Select &amp; Case Statements"}]},{"@type":"WebSite","@id":"https:\/\/greenwebpage.com\/community\/#website","url":"https:\/\/greenwebpage.com\/community\/","name":"Greenwebpage Community","description":"Get online in three steps with our wide range of web hosting solutions. Choose from professional business to enterprise options designed to meet your needs.","publisher":{"@id":"https:\/\/greenwebpage.com\/community\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/greenwebpage.com\/community\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/greenwebpage.com\/community\/#organization","name":"Greenwebpage Community","url":"https:\/\/greenwebpage.com\/community\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/greenwebpage.com\/community\/#\/schema\/logo\/image\/","url":"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2023\/10\/cropped-logomic.png","contentUrl":"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2023\/10\/cropped-logomic.png","width":512,"height":512,"caption":"Greenwebpage Community"},"image":{"@id":"https:\/\/greenwebpage.com\/community\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/greenwebpage.com\/community\/#\/schema\/person\/467c100c1d017bc081473ee0440680c8","name":"Karim Buzdar","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/greenwebpage.com\/community\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/0628fcbcddd9bc5486245d2cf4a904dbcdeac9ad6c3098f49237094e9d513d0c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0628fcbcddd9bc5486245d2cf4a904dbcdeac9ad6c3098f49237094e9d513d0c?s=96&d=mm&r=g","caption":"Karim Buzdar"},"sameAs":["https:\/\/greenwebpage.com"],"url":"https:\/\/greenwebpage.com\/community\/author\/karim\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/posts\/12699","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/comments?post=12699"}],"version-history":[{"count":4,"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/posts\/12699\/revisions"}],"predecessor-version":[{"id":12710,"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/posts\/12699\/revisions\/12710"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/media\/12707"}],"wp:attachment":[{"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/media?parent=12699"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/categories?post=12699"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/tags?post=12699"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}