{"id":22183,"date":"2023-09-18T09:39:21","date_gmt":"2023-09-18T09:39:21","guid":{"rendered":"https:\/\/linuxsimply.com\/?p=22183"},"modified":"2024-02-14T10:04:39","modified_gmt":"2024-02-14T10:04:39","slug":"bash-increment-variable","status":"publish","type":"post","link":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/increment-variable\/","title":{"rendered":"Increment Variable Value in Bash Scripts [4+ Examples]"},"content":{"rendered":"<p style=\"text-align: justify;\">The <strong>increment of the Bash variable<\/strong> means increasing the value of a variable. It is an important technique for the Bash programmer to do a specific task repetitively. Here, I will explore the techniques of <strong>pre-increment<\/strong> and <strong>post-increment<\/strong> using the for loop, the while loop, and the until loop. After reading this article, I hope you will be skillful enough to increment the Bash variable.<\/p>\n<div class=\"su-button-center\"><a href=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/bash-increment-variable-scripts.zip\" class=\"su-button su-button-style-default\" style=\"color:#000000;background-color:#E8F9FF;border-color:#bac8cc;border-radius:56px\" target=\"_blank\" rel=\"noopener noreferrer\"><span style=\"color:#000000;padding:8px 26px;font-size:20px;line-height:30px;border-color:#effbff;border-radius:56px;text-shadow:0px 0px 0px #000000\"><i class=\"sui sui-download\" style=\"font-size:20px;color:#1AA1D6\"><\/i> Practice Files to Increment Variable Value in Bash Scripts<\/span><\/a><\/div>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" 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: #999;color:#999\" 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><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 eztoc-toggle-hide-by-default' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/increment-variable\/#What_is_Increment_in_Bash\" >What is Increment in Bash?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/increment-variable\/#Operators_to_Increment_Bash_Variable\" >Operators to Increment Bash Variable<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/increment-variable\/#How_to_Increment_a_Variable_in_Bash\" >How to Increment a Variable in Bash?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/increment-variable\/#4_Examples_Showing_the_Increment_of_Bash_Variable\" >4 Examples Showing the Increment of Bash Variable<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/increment-variable\/#Example_01_Increment_the_Variable_in_Bash\" >Example 01: Increment the Variable in Bash<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/increment-variable\/#Case_01_Using_%E2%80%9Cx%E2%80%9D_Syntax_to_Post_Increment_Variable_in_Bash\" >Case 01: Using &#8220;x++&#8221; Syntax to Post Increment Variable in Bash<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/increment-variable\/#Case_02_Using_%E2%80%9Cx%E2%80%9D_Syntax_for_Pre_Increment_Variable_in_Bash\" >Case 02: Using &#8220;++x&#8221; Syntax for Pre Increment Variable in Bash<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/increment-variable\/#Example_02_Increment_Variable_Value_With_%E2%80%9Cfor%E2%80%9D_Loop\" >Example 02: Increment Variable Value With &#8220;for&#8221; Loop<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/increment-variable\/#Case_01_Using_%E2%80%9Cfor%E2%80%9D_Loop_to_Perform_Pre-increment_of_Variable\" >Case 01: Using &#8220;for&#8221; Loop to Perform Pre-increment of Variable<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/increment-variable\/#Case_02_Using_%E2%80%9Cfor%E2%80%9D_Loop_to_Perform_Post-Increment_of_Variable\" >Case 02: Using &#8220;for&#8221; Loop to Perform Post-Increment of Variable<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/increment-variable\/#Example_03_Increment_Variable_Value_With_%E2%80%9Cwhile%E2%80%9D_Loop\" >Example 03: Increment Variable Value With &#8220;while&#8221; Loop<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/increment-variable\/#Case_01_Incrementing_a_Variable_Using_%E2%80%9Cwhile%E2%80%9D_Loop_With_%E2%80%9C%E2%80%9D_Notation\" >Case 01: Incrementing a Variable Using \u201cwhile\u201d Loop With \u201c+=\u201d Notation<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/increment-variable\/#Case_02_Incrementing_a_Variable_Using_%E2%80%9Cwhile%E2%80%9D_Loop_With_%E2%80%9C1%E2%80%9D_Notation\" >Case 02: Incrementing a Variable Using \u201cwhile\u201d Loop With \u201c+1\u201d Notation<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/increment-variable\/#Example_04_Increment_Variable_in_Bash_Using_%E2%80%9CUntil%E2%80%9D_Loop\" >Example 04: Increment Variable in Bash Using &#8220;Until&#8221; Loop<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/increment-variable\/#Conclusion\" >Conclusion<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/increment-variable\/#People_Also_Ask\" >People Also Ask<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-17\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/increment-variable\/#How_do_you_increment_a_variable_in_bash\" >How do you increment a variable in bash?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-18\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/increment-variable\/#How_do_you_increment_a_function_in_bash\" >How do you increment a function in bash?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-19\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/increment-variable\/#How_do_you_set_a_variable_to_increment\" >How do you set a variable to increment?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-20\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/increment-variable\/#Can_a_variable_be_replaced_by_any_value\" >Can a variable be replaced by any value?<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"What_is_Increment_in_Bash\"><\/span>What is Increment in Bash?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"text-align: justify;\">The increment is mainly the operation of <strong>increasing the value of a variable<\/strong>. It is an important tool for bash programmers. You can increase variable value by one, two, three, four, etc., according to your necessity. There are two types of increments in Bash, such as:<\/p>\n<ul>\n<li style=\"text-align: justify;\"><strong>Post-increment:<\/strong> In post-increment, at first, the variable&#8217;s value is returned, then the value is increased. The syntax for pre-increment is:\n<pre><code class=\"language-bash\" data-line=\"\">++variable<\/code><\/pre>\n<\/li>\n<li style=\"text-align: justify;\"><strong>Pre-increment:<\/strong> In pre-increment, at first, the variable&#8217;s value is increased, and then the value is returned. The syntax for post-increment is:\n<pre><code class=\"language-bash\" data-line=\"\">variable++<\/code><\/pre>\n<\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"Operators_to_Increment_Bash_Variable\"><\/span>Operators to Increment Bash Variable<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"text-align: justify;\">There are some operators used to increment the bash variable. A list of some of these operators is given below:<\/p>\n<div class=\"su-table su-table-responsive su-table-alternate su-table-fixed\">\n<table style=\"height: 181px;width: 100%\" width=\"100%\">\n<thead>\n<tr style=\"height: 16px\">\n<th style=\"height: 16px;width: 20.1529%\" width=\"312\"><strong>Operators<\/strong><\/th>\n<th style=\"height: 16px;width: 94.7678%\" width=\"312\"><strong>Function<\/strong><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr style=\"height: 63px\">\n<td style=\"text-align: center;height: 63px;width: 20.1529%\" width=\"312\"><strong>+<\/strong><\/td>\n<td style=\"text-align: center;height: 63px;width: 94.7678%\" width=\"312\">Basic operator for increment. An example of this operator is variable = variable + 1.<\/td>\n<\/tr>\n<tr style=\"height: 51px\">\n<td style=\"text-align: center;height: 51px;width: 20.1529%\" width=\"312\"><strong>++<\/strong><\/td>\n<td style=\"text-align: center;height: 51px;width: 94.7678%\" width=\"312\">An example of this operator is ++variable.<\/td>\n<\/tr>\n<tr style=\"height: 51px\">\n<td style=\"text-align: center;height: 51px;width: 20.1529%\" width=\"312\"><strong>+=<\/strong><\/td>\n<td style=\"text-align: center;height: 51px;width: 94.7678%\" width=\"312\">An example of this operator is variable+=1.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<h2><span class=\"ez-toc-section\" id=\"How_to_Increment_a_Variable_in_Bash\"><\/span>How to Increment a Variable in Bash?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"text-align: justify;\">To increment a variable in Bash, you can use the <code class=\"\" data-line=\"\">((var++))<\/code> syntax, which increases the variable value by one. Here&#8217;s a simple example:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">var=1\n((var++))\necho $var<\/code><\/pre>\n<p style=\"text-align: justify;\"><strong>Output:<\/strong> <strong>2<\/strong><br \/>\nIn this example, <code class=\"\" data-line=\"\">var<\/code> starts at <strong>1<\/strong>, and <code class=\"\" data-line=\"\">((var++))<\/code> increments it by one. The <code class=\"\" data-line=\"\">echo $var<\/code> command prints the updated value, which is <strong>2<\/strong>. This is the simplest method to increment a bash variable, but there are some more practical approaches. Read the following article for more details.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"4_Examples_Showing_the_Increment_of_Bash_Variable\"><\/span>4 Examples Showing the Increment of Bash Variable<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"text-align: justify;\">Incrementing the bash variable is a necessary operation for looping, counting, progress tracking, and conditional operations. These operations are necessary for data manipulation and automate complex tasks.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Example_01_Increment_the_Variable_in_Bash\"><\/span>Example 01: Increment the Variable in Bash<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">You can do <strong>post-increment<\/strong> by using the <code class=\"\" data-line=\"\">x++<\/code> operator and <strong>pre-increment<\/strong> by using the <code class=\"\" data-line=\"\">++x<\/code> operator. In the following two cases, I will discuss each of the processes in detail:<\/p>\n<h4><span class=\"ez-toc-section\" id=\"Case_01_Using_%E2%80%9Cx%E2%80%9D_Syntax_to_Post_Increment_Variable_in_Bash\"><\/span>Case 01: Using &#8220;x++&#8221; Syntax to Post Increment Variable in Bash<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p style=\"text-align: justify;\">In post-increment operation, increment operation can be done after the main task. Here, I will develop a script where the value of <strong>variable x<\/strong> will be assigned to <strong>variable a<\/strong>, and then the value of <strong>variable x will be incremented<\/strong>.<\/p>\n<p style=\"text-align: justify;\">To post-increment the variable using the &#8220;x++&#8221; syntax, see the below Bash script:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">#!\/bin\/bash\n#assigning value to a\nx=10\n#post increment of the variable a\na=$((x++));\n#printing the value of a\necho $a<\/code><\/pre>\n<div class=\"su-box su-box-style-default\" id=\"\" style=\"border-color:#aeb0b3;border-radius:0px;max-width:none\"><div class=\"su-box-title\" style=\"background-color:#E1E3E6;color:#000000;border-top-left-radius:0px;border-top-right-radius:0px\"> EXPLANATION<\/div><div class=\"su-box-content su-u-clearfix su-u-trim\" style=\"border-bottom-left-radius:0px;border-bottom-right-radius:0px\">\n<p style=\"text-align: justify;\">In the first script line, <code class=\"\" data-line=\"\">#! \/bin\/bash<\/code>, <code class=\"\" data-line=\"\">#!<\/code>, is called <strong>shebang or hashbang<\/strong>. It indicates the interpreter to be used for executing the script, in this case, it\u2019s bash. After that, the <code class=\"\" data-line=\"\">x=10<\/code> command assigned a value to the <code class=\"\" data-line=\"\">x<\/code> variable. Afterward, the <code class=\"\" data-line=\"\">a=$((x++));<\/code> command has post-incremented the <strong>x<\/strong> variable and assigned it to <code class=\"\" data-line=\"\">a<\/code> variable. Finally, the <code class=\"\" data-line=\"\">echo $a<\/code> command has printed the value of the variable on the terminal. <\/div><\/div>\n<p style=\"text-align: justify;\"><img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter wp-image-22192 size-full\" src=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/1-pre-increment.png\" alt=\"The post-increment has been done on the variable using the x++ operation and so first the initial value 10 is printed on the terminal then the value is increased from 10 to 11.\" width=\"700\" height=\"173\" srcset=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/1-pre-increment.png 700w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/1-pre-increment-300x74.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/>The image shows that post-increment has been done on the variable. First, the initial variable value of <strong>10<\/strong> is printed on the terminal then the value is increased from <strong>10<\/strong> to <strong>11<\/strong>.<\/p>\n<h4><span class=\"ez-toc-section\" id=\"Case_02_Using_%E2%80%9Cx%E2%80%9D_Syntax_for_Pre_Increment_Variable_in_Bash\"><\/span>Case 02: Using &#8220;++x&#8221; Syntax for Pre Increment Variable in Bash<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p style=\"text-align: justify;\">In pre-increment operation, increment operation can be done before the main task. Here I will develop a script where the value of variable x will be incremented, and then the incremented value will be assigned to variable<strong> a<\/strong>. To know more, follow the below script:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">#!\/bin\/bash\n#assigning value to a\nx=10\n#pre increment of the variable a\na=$((++x));\n#printing the value of a\necho $a<\/code><\/pre>\n<div class=\"su-box su-box-style-default\" id=\"\" style=\"border-color:#aeb0b3;border-radius:0px;max-width:none\"><div class=\"su-box-title\" style=\"background-color:#E1E3E6;color:#000000;border-top-left-radius:0px;border-top-right-radius:0px\"> EXPLANATION<\/div><div class=\"su-box-content su-u-clearfix su-u-trim\" style=\"border-bottom-left-radius:0px;border-bottom-right-radius:0px\">\n<p style=\"text-align: justify;\">The <code class=\"\" data-line=\"\">x=10<\/code> command assigned a value to the <code class=\"\" data-line=\"\">x<\/code> variable. Afterward, the <code class=\"\" data-line=\"\">a=$((++x));<\/code> command has pre-incremented the <strong>x<\/strong> variable and assigned it to the <code class=\"\" data-line=\"\">a<\/code> variable. Finally, the <code class=\"\" data-line=\"\">echo $a<\/code> command has printed the value of the variable on the terminal.<\/div><\/div>\n<p style=\"text-align: justify;\"><img decoding=\"async\" class=\"aligncenter wp-image-22193 size-full\" src=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/2-pre-increment.png\" alt=\"The pre-increment has been done on the variable using the ++x increment operator and so the value is increased first from 10 to 11 then the value is printed on the terminal.\" width=\"700\" height=\"178\" srcset=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/2-pre-increment.png 700w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/2-pre-increment-300x76.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/>The image shows that pre-increment has been done on the variable, so the value is increased first from <strong>10<\/strong> to <strong>11<\/strong> and then printed on the terminal.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Example_02_Increment_Variable_Value_With_%E2%80%9Cfor%E2%80%9D_Loop\"><\/span>Example 02: Increment Variable Value With &#8220;for&#8221; Loop<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">In this section, I will show you the process of <strong>incrementing variables using the for loop<\/strong>. In the first case, I will show you pre-increment, and in the second case, I will show you post-increment.<\/p>\n<h4><span class=\"ez-toc-section\" id=\"Case_01_Using_%E2%80%9Cfor%E2%80%9D_Loop_to_Perform_Pre-increment_of_Variable\"><\/span>Case 01: Using &#8220;for&#8221; Loop to Perform Pre-increment of Variable<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p style=\"text-align: justify;\">In pre-increment operation, increment operation can be done before the main task utilizing the <a href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/\" target=\"_blank\" rel=\"noopener\"><strong>bash<\/strong> <strong>for loop<\/strong><\/a>. Here I will develop a script where the value of the variable<strong> x <\/strong>will be incremented, and then the incremented value will be assigned to variable<strong> a<\/strong>. To know more, follow the below script:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">#!\/bin\/bash\n#initializing for loop\nfor ((i=0; i&lt;5; ++i)); do\n#printing the value of the variable i\necho $i\ndone<\/code><\/pre>\n<div class=\"su-box su-box-style-default\" id=\"\" style=\"border-color:#aeb0b3;border-radius:0px;max-width:none\"><div class=\"su-box-title\" style=\"background-color:#E1E3E6;color:#000000;border-top-left-radius:0px;border-top-right-radius:0px\"> EXPLANATION<\/div><div class=\"su-box-content su-u-clearfix su-u-trim\" style=\"border-bottom-left-radius:0px;border-bottom-right-radius:0px\">\n<p style=\"text-align: justify;\">The <code class=\"\" data-line=\"\">for ((i=0; i&lt;5; ++i); do<\/code> command <strong>initialize the for loop<\/strong> with the value of the <code class=\"\" data-line=\"\">i<\/code> variable<strong> 0 <\/strong>and increment it by one on every iteration. After that, the <code class=\"\" data-line=\"\">echo $i<\/code> command will print every value of<strong> i<\/strong>.<\/div><\/div>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-22194 size-full\" src=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/3-pre-increment-for-loop.png\" alt=\"The pre-increment has been done on the variable utilizing the for loop with ++ increment operator.\" width=\"700\" height=\"303\" srcset=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/3-pre-increment-for-loop.png 700w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/3-pre-increment-for-loop-300x130.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/>Upon execution, the script prints pre-incremented values on the terminal.<\/p>\n<h4><span class=\"ez-toc-section\" id=\"Case_02_Using_%E2%80%9Cfor%E2%80%9D_Loop_to_Perform_Post-Increment_of_Variable\"><\/span>Case 02: Using &#8220;for&#8221; Loop to Perform Post-Increment of Variable<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p style=\"text-align: justify;\">In post-increment operation, increment operation can be done after the main task utilizing the for loop. Here, I will develop a script where the value of variable x will be assigned to variable a, and then the value of variable x will be incremented. To know more, follow the below script:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">#!\/bin\/bash\n#initializing for loop\nfor ((i=0; i&lt;5; i++)); do\n#printing the value of the variable i\necho $i\ndone<\/code><\/pre>\n<div class=\"su-box su-box-style-default\" id=\"\" style=\"border-color:#aeb0b3;border-radius:0px;max-width:none\"><div class=\"su-box-title\" style=\"background-color:#E1E3E6;color:#000000;border-top-left-radius:0px;border-top-right-radius:0px\"> EXPLANATION<\/div><div class=\"su-box-content su-u-clearfix su-u-trim\" style=\"border-bottom-left-radius:0px;border-bottom-right-radius:0px\">\n<p style=\"text-align: justify;\">The <code class=\"\" data-line=\"\">for ((i=0; i&lt;5; i++); do<\/code> command <strong>initialize the for loop <\/strong>with the value of <code class=\"\" data-line=\"\">i<\/code><strong> variable 0<\/strong> and increment it by one on every iteration. After that, the <code class=\"\" data-line=\"\">echo $i<\/code> command has printed <strong>every value of i<\/strong>. After printing the value, the value of the <strong>i<\/strong> variable is incremented.<\/div><\/div>\n<p style=\"text-align: justify;\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-22195 size-full\" src=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/4-post-increment-for-loop.png\" alt=\"The post-increment has been done on the variable utilizing the for loop with i++ increment.\" width=\"700\" height=\"295\" srcset=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/4-post-increment-for-loop.png 700w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/4-post-increment-for-loop-300x126.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/>The image shows that post-increment has been done on the variable utilizing the for loop with <strong>i++ increment<\/strong>.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Example_03_Increment_Variable_Value_With_%E2%80%9Cwhile%E2%80%9D_Loop\"><\/span>Example 03: Increment Variable Value With &#8220;while&#8221; Loop<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">The <strong>while loop<\/strong> is another approach to increment variables. Here, I will briefly show you two cases of increasing variable value with the while loop. The first one is by using <strong>+= <\/strong>notation, and the second one is by using<strong> +1 <\/strong>notation.<\/p>\n<h4><span class=\"ez-toc-section\" id=\"Case_01_Incrementing_a_Variable_Using_%E2%80%9Cwhile%E2%80%9D_Loop_With_%E2%80%9C%E2%80%9D_Notation\"><\/span>Case 01: Incrementing a Variable Using \u201cwhile\u201d Loop With \u201c+=\u201d Notation<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p style=\"text-align: justify;\">You can increment a variable using the <a href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/while-loop\/\" target=\"_blank\" rel=\"noopener\"><strong>while loop<\/strong><\/a> with <code class=\"\" data-line=\"\">+=<\/code> notation. Here, I will accomplish this by developing a Bash script. To know more, follow the below script:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">#!\/bin\/bash\ni=0\nwhile [ $i -lt 5 ]\ndo\necho $i\nlet \u201ci+=1\u201d\ndone<\/code><\/pre>\n<div class=\"su-box su-box-style-default\" id=\"\" style=\"border-color:#aeb0b3;border-radius:0px;max-width:none\"><div class=\"su-box-title\" style=\"background-color:#E1E3E6;color:#000000;border-top-left-radius:0px;border-top-right-radius:0px\"> EXPLANATION<\/div><div class=\"su-box-content su-u-clearfix su-u-trim\" style=\"border-bottom-left-radius:0px;border-bottom-right-radius:0px\">\n<p>The <code class=\"\" data-line=\"\">i=0<\/code> command assigned the value of i equal to zero. Then, the <code class=\"\" data-line=\"\">while [ $i -lt 5 ]<\/code> command initiates the while loop and checks whether <strong>i is less than 5<\/strong>, and if the condition is true, it passes a zero status and thus executes the <code class=\"\" data-line=\"\">echo $i<\/code> command. Then, the <code class=\"\" data-line=\"\">let \u201ci+=1\u201d<\/code> command increments the value of <code class=\"\" data-line=\"\">i<\/code> by one. Finally, <strong>done<\/strong> denotes the end of the <strong>while<\/strong> loop.<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-22196 size-full\" src=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/5-increment-variable-while-loop-notation.png\" alt=\"The value of the variable i has been increased one by one using the while loop with += notation.\" width=\"700\" height=\"298\" srcset=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/5-increment-variable-while-loop-notation.png 700w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/5-increment-variable-while-loop-notation-300x128.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/>See from the image that the value of the <strong>variable i<\/strong> has been <strong>increased one by one.<\/strong><\/p>\n<h4><span class=\"ez-toc-section\" id=\"Case_02_Incrementing_a_Variable_Using_%E2%80%9Cwhile%E2%80%9D_Loop_With_%E2%80%9C1%E2%80%9D_Notation\"><\/span>Case 02: Incrementing a Variable Using \u201cwhile\u201d Loop With \u201c+1\u201d Notation<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p style=\"text-align: justify;\">You can increment a variable using the while loop with <code class=\"\" data-line=\"\">+1<\/code> notation. Here, I will accomplish this by developing a Bash script. To see the process practically, execute the below script:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">#!\/bin\/bash\ni=0\nwhile [ $i -lt 5 ]\ndo\necho $i\nlet \u201ci=i+1\u201d\ndone<\/code><\/pre>\n<div class=\"su-box su-box-style-default\" id=\"\" style=\"border-color:#aeb0b3;border-radius:0px;max-width:none\"><div class=\"su-box-title\" style=\"background-color:#E1E3E6;color:#000000;border-top-left-radius:0px;border-top-right-radius:0px\"> EXPLANATION<\/div><div class=\"su-box-content su-u-clearfix su-u-trim\" style=\"border-bottom-left-radius:0px;border-bottom-right-radius:0px\">\n<p style=\"text-align: justify;\">The <code class=\"\" data-line=\"\">i=0<\/code> command assigned the value of i equal to zero. Then the <code class=\"\" data-line=\"\">while [ $i -lt 5 ]<\/code> command initiates the <strong>while<\/strong> loop and checks whether <strong>i is less than 5<\/strong>, and if the condition is true it passes a zero status and thus executes the <code class=\"\" data-line=\"\">echo $i<\/code> command. Then, the <code class=\"\" data-line=\"\">let \u201ci+=1\u201d<\/code> command increments the value of <code class=\"\" data-line=\"\">i<\/code> by one. Finally, <strong>done<\/strong> denotes the end of the <strong>while<\/strong> loop.<\/div><\/div>\n<p style=\"text-align: justify;\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-22197 size-full\" src=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/6-increment-variable-while-loop-with-1-notation.png\" alt=\"The value of the variable i has been increased one by one using the while loop with +1 notation.\" width=\"700\" height=\"286\" srcset=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/6-increment-variable-while-loop-with-1-notation.png 700w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/6-increment-variable-while-loop-with-1-notation-300x123.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/>The image shows that the value of the <strong>variable i<\/strong> has been <strong>increased one by one<\/strong> using the while loop with +1 notation.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Example_04_Increment_Variable_in_Bash_Using_%E2%80%9CUntil%E2%80%9D_Loop\"><\/span>Example 04: Increment Variable in Bash Using &#8220;Until&#8221; Loop<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">The <a href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/until-loop\/\" target=\"_blank\" rel=\"noopener\"><strong>until loop<\/strong><\/a> is a different type of loop, It passes a zero return value until the condition is true. Thus, a command inside the loop is executed. Here, I have a bash script that has a until loop inside it and does an increment operation. See the below script to check the entire process:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">#!\/bin\/bash\n#value of the i has been assigned\ni=0\n#until loop will execute the echo command inside it until i value is greater than 5\nuntil [ $i -gt 5 ]\ndo\n#value of i will be printed on the terminal\necho $i\n#value of i will be increased by one and will be saved on the i variable\ni=$((i+1))\ndone<\/code><\/pre>\n<div class=\"su-box su-box-style-default\" id=\"\" style=\"border-color:#aeb0b3;border-radius:0px;max-width:none\"><div class=\"su-box-title\" style=\"background-color:#E1E3E6;color:#000000;border-top-left-radius:0px;border-top-right-radius:0px\"> EXPLANATION<\/div><div class=\"su-box-content su-u-clearfix su-u-trim\" style=\"border-bottom-left-radius:0px;border-bottom-right-radius:0px\">\n<p style=\"text-align: justify;\">The <code class=\"\" data-line=\"\">i=0<\/code> command has assigned zero as a value of i. After that the <code class=\"\" data-line=\"\">until [ $i -gt 5 ]<\/code> command initiates the until loop and executes the inside command until the value of<strong> i is not greater than 5<\/strong>. Inside the loop, the <code class=\"\" data-line=\"\">echo $i<\/code> command prints the value of the i variable on the terminal. Afterwards, the<code class=\"\" data-line=\"\">&lt;strong&gt; i=$((i+1))&lt;\/strong&gt;<\/code> command increments the value of the i variable by one. Finally, the <strong>done<\/strong> command denotes the <strong>end of the until loop<\/strong>.<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-22198 size-full\" src=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/7-until-loop.png\" alt=\"The integer from 0 to 5 has been printed on the terminal using the until loop with +1 operation.\" width=\"700\" height=\"329\" srcset=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/7-until-loop.png 700w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/7-until-loop-300x141.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/>See from the image, the script prints integers from 0 to 5 on the terminal.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"text-align: justify;\">In this article, I have shown you some techniques to pre-increment and post-increment the bash variables utilizing for loop, while loop, and until loop. These discussed cases and examples will help you to do bash variables more productively.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"People_Also_Ask\"><\/span>People Also Ask<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"How_do_you_increment_a_variable_in_bash\"><\/span>How do you increment a variable in bash?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">To increment a variable in bash, you can use different syntaxes. Some of these command syntaxes are <code class=\"\" data-line=\"\">variable = variable + 1<\/code>, <code class=\"\" data-line=\"\">++variable<\/code>, <code class=\"\" data-line=\"\">variable+=1<\/code>, etc.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"How_do_you_increment_a_function_in_bash\"><\/span>How do you increment a function in bash?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">To increment a variable within a function in bash, you can use the <code class=\"\" data-line=\"\">++<\/code> operator which increments its operand by<strong> 1<\/strong> and returns the value. The operator can be used before or after the operand. They are also known as prefix increments: <code class=\"\" data-line=\"\">++i<\/code>.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"How_do_you_set_a_variable_to_increment\"><\/span>How do you set a variable to increment?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">To increment a variable number each time, <strong>you can add 1 to the variable using the increment operator <\/strong><code class=\"\" data-line=\"\">++<\/code>. This will increase the variable&#8217;s value by <strong>1<\/strong> each time it is called. For example, each time <code class=\"\" data-line=\"\">num++<\/code> is called, it increments the value of num by <strong>1<\/strong>.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Can_a_variable_be_replaced_by_any_value\"><\/span>Can a variable be replaced by any value?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\"><strong>Yes<\/strong>, you can, and often do, replace the old value of a variable based on the current value of the variable.<\/p>\n<p><script type=\"application\/ld+json\">\n{\n  \"@context\": \"https:\/\/schema.org\",\n  \"@type\": \"FAQPage\",\n  \"mainEntity\": [{\n    \"@type\": \"Question\",\n    \"name\": \"How do you increment a variable in bash?\",\n    \"acceptedAnswer\": {\n      \"@type\": \"Answer\",\n      \"text\": \"To increment a variable in bash, you can use different syntaxes. Some of these command syntaxes are variable = variable + 1, ++variable, variable+=1, etc.\"\n    }\n  },{\n    \"@type\": \"Question\",\n    \"name\": \"How do you increment a function in bash?\",\n    \"acceptedAnswer\": {\n      \"@type\": \"Answer\",\n      \"text\": \"To increment a variable within a function in bash, you can use the ++ operator which increments its operand by 1 and returns the value. The operator can be used before or after the operand. They are also known as prefix increments: ++i.\"\n    }\n  },{\n    \"@type\": \"Question\",\n    \"name\": \"How do you set a variable to increment?\",\n    \"acceptedAnswer\": {\n      \"@type\": \"Answer\",\n      \"text\": \"To increment a variable number each time, you can add 1 to the variable using the increment operator ++. This will increase the variable's value by 1 each time it is called. For example, each time num++ is called, it increments the value of num by 1.\"\n    }\n  },{\n    \"@type\": \"Question\",\n    \"name\": \"Can a variable be replaced by any value?\",\n    \"acceptedAnswer\": {\n      \"@type\": \"Answer\",\n      \"text\": \"Yes, you can, and often do, replace the old value of a variable based on the current value of the variable.\"\n    }\n  }]\n}\n<\/script><\/p>\n<p><span style=\"font-size: 18pt; color: #003366;\"><strong>Related Articles<\/strong><\/span><\/p>\n<ul>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/echo-variable\/\" target=\"_blank\" rel=\"noopener\">How to Echo Variables in Bash Script? [4 Practical Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/use-variable-in-string\/\" target=\"_blank\" rel=\"noopener\">How to Use String Variables in Bash Script? [4 Cases]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/append-string-to-variable\/\" target=\"_blank\" rel=\"noopener\">How to Append String to Bash Variable? [2 Effective Ways]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/check-if-variable-exists\/\" target=\"_blank\" rel=\"noopener\">How to Check If Bash Variable Exists? [2 Effective Methods]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/check-if-variable-is-empty\/\" target=\"_blank\" rel=\"noopener\">How To Check if Bash Variable is Empty? [2 Easy Methods]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/set-and-list-environment-variables\/\" target=\"_blank\" rel=\"noopener\">How to List and Set Bash Environment Variables? [3 Methods]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/unset-env-variable\/\" target=\"_blank\" rel=\"noopener\">2 Ways to Unset Environment Variables Using Bash Script<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/check-if-environment-variable-is-set\/\" target=\"_blank\" rel=\"noopener\">5 Methods to Check If Environment Variable is Set in Bash Script<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/path-variable\/\" target=\"_blank\" rel=\"noopener\">How to Set Bash $PATH Variable? [Easiest Configuration]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/execute-command-in-variable\/\" target=\"_blank\" rel=\"noopener\">2 Cases to Execute Command Stored in Bash Variable<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/command-output-to-variable\/\" target=\"_blank\" rel=\"noopener\">How to Store Command Output to Bash Variable? [3 Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/read-file-into-variable\/\" target=\"_blank\" rel=\"noopener\">How to Read a File into Bash Variable? [2 Simple Methods]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/write-variable-to-file\/\" target=\"_blank\" rel=\"noopener\">How to Write Bash Variable to File? [3 Effective Methods]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/compare-variables\/\" target=\"_blank\" rel=\"noopener\">Compare Variables in Bash Scripts [3 Practical Cases]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/add-1-to-variable\/\" target=\"_blank\" rel=\"noopener\">Adding 1 to Bash Variable [3 Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/decrement-variable\/\" target=\"_blank\" rel=\"noopener\">Decrement Variable Value in Bash Scripts [4+ Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/variable-addition\/\" target=\"_blank\" rel=\"noopener\">Addition of Bash Variable [4+ Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/subtract-two-variables\/\" target=\"_blank\" rel=\"noopener\">How to Subtract Two Bash Variables? [4+ Easy Approaches]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/multiply-variable\/\" target=\"_blank\" rel=\"noopener\">How to Multiply Variable in Bash [6+ Practical Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/variable-substitution\/\" target=\"_blank\" rel=\"noopener\">Variable Substitution in Bash [Replace Character &amp; Substring]<\/a><\/strong><\/li>\n<\/ul>\n<hr \/>\n<p><strong>&lt;&lt; Go Back to <span data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Using Variables in Bash Scripting&quot;}\" data-sheets-userformat=\"{&quot;2&quot;:1074113,&quot;3&quot;:{&quot;1&quot;:0},&quot;9&quot;:1,&quot;10&quot;:1,&quot;11&quot;:4,&quot;12&quot;:0,&quot;16&quot;:12,&quot;17&quot;:1,&quot;23&quot;:1}\" data-sheets-hyperlink=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/\"><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/\" target=\"_blank\" rel=\"noopener\">Using Variables in Bash Scripting<\/a><\/span> | <span data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Bash Variables&quot;}\" data-sheets-userformat=\"{&quot;2&quot;:1074113,&quot;3&quot;:{&quot;1&quot;:0},&quot;9&quot;:1,&quot;10&quot;:1,&quot;11&quot;:4,&quot;12&quot;:0,&quot;16&quot;:12,&quot;17&quot;:1,&quot;23&quot;:1}\" data-sheets-hyperlink=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/\"><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/\" target=\"_blank\" rel=\"noopener\">Bash Variables<\/a><\/span> | <span data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Bash Scripting Tutorial&quot;}\" data-sheets-userformat=\"{&quot;2&quot;:1074113,&quot;3&quot;:{&quot;1&quot;:0},&quot;9&quot;:1,&quot;10&quot;:1,&quot;11&quot;:4,&quot;12&quot;:0,&quot;16&quot;:12,&quot;17&quot;:1,&quot;23&quot;:1}\" data-sheets-hyperlink=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/\"><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/\" target=\"_blank\" rel=\"noopener\">Bash Scripting Tutorial<\/a><\/span><\/strong><\/p>\n\n\n<div class=\"kk-star-ratings kksr-auto kksr-align-center kksr-valign-bottom\"\n    data-payload='{&quot;align&quot;:&quot;center&quot;,&quot;id&quot;:&quot;22183&quot;,&quot;slug&quot;:&quot;default&quot;,&quot;valign&quot;:&quot;bottom&quot;,&quot;ignore&quot;:&quot;&quot;,&quot;reference&quot;:&quot;auto&quot;,&quot;class&quot;:&quot;&quot;,&quot;count&quot;:&quot;7&quot;,&quot;legendonly&quot;:&quot;&quot;,&quot;readonly&quot;:&quot;&quot;,&quot;score&quot;:&quot;5&quot;,&quot;starsonly&quot;:&quot;&quot;,&quot;best&quot;:&quot;5&quot;,&quot;gap&quot;:&quot;5&quot;,&quot;greet&quot;:&quot;Rate this post&quot;,&quot;legend&quot;:&quot;5\\\/5 - (7 votes)&quot;,&quot;size&quot;:&quot;24&quot;,&quot;title&quot;:&quot;Increment Variable Value in Bash Scripts [4+ Examples]&quot;,&quot;width&quot;:&quot;142.5&quot;,&quot;_legend&quot;:&quot;{score}\\\/{best} - ({count} {votes})&quot;,&quot;font_factor&quot;:&quot;1.25&quot;}'>\n            \n<div class=\"kksr-stars\">\n    \n<div class=\"kksr-stars-inactive\">\n            <div class=\"kksr-star\" data-star=\"1\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"2\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"3\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"4\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"5\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n    <\/div>\n    \n<div class=\"kksr-stars-active\" style=\"width: 142.5px;\">\n            <div class=\"kksr-star\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n    <\/div>\n<\/div>\n                \n\n<div class=\"kksr-legend\" style=\"font-size: 19.2px;\">\n            5\/5 - (7 votes)    <\/div>\n    <\/div>\n","protected":false},"excerpt":{"rendered":"<p>The increment of the Bash variable means increasing the value of a variable. It is an important technique for the &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"Increment Variable Value in Bash Scripts [4+ Examples]\" class=\"read-more button\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/increment-variable\/#more-22183\" aria-label=\"Read more about Increment Variable Value in Bash Scripts [4+ Examples]\">Read more<\/a><\/p>\n","protected":false},"author":314894,"featured_media":22199,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[102],"tags":[121],"class_list":["post-22183","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-bash-scripting","tag-using-variables-in-bash","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-33"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Increment Variable Value in Bash Scripts [4+ Examples] - LinuxSimply<\/title>\n<meta name=\"description\" content=\"When you want to do a specific task repeatatively for a certain time, you can use the bash increment variable technique for your convenience.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/increment-variable\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Increment Variable Value in Bash Scripts [4+ Examples] - LinuxSimply\" \/>\n<meta property=\"og:description\" content=\"When you want to do a specific task repeatatively for a certain time, you can use the bash increment variable technique for your convenience.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/increment-variable\/\" \/>\n<meta property=\"og:site_name\" content=\"LinuxSimply\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/dasgupta.susmit\" \/>\n<meta property=\"article:published_time\" content=\"2023-09-18T09:39:21+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-02-14T10:04:39+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/bash-increment-variable-feature-image.png\" \/>\n\t<meta property=\"og:image:width\" content=\"400\" \/>\n\t<meta property=\"og:image:height\" content=\"400\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Susmit Das Gupta\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Susmit Das Gupta\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/variables\\\/usage\\\/increment-variable\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/variables\\\/usage\\\/increment-variable\\\/\"},\"author\":{\"name\":\"Susmit Das Gupta\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/#\\\/schema\\\/person\\\/38abbef9a1053d9faec8935dc39f10fa\"},\"headline\":\"Increment Variable Value in Bash Scripts [4+ Examples]\",\"datePublished\":\"2023-09-18T09:39:21+00:00\",\"dateModified\":\"2024-02-14T10:04:39+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/variables\\\/usage\\\/increment-variable\\\/\"},\"wordCount\":1845,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/variables\\\/usage\\\/increment-variable\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2023\\\/09\\\/bash-increment-variable-feature-image.png\",\"keywords\":[\"using variables in bash\"],\"articleSection\":[\"Bash Scripting\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/variables\\\/usage\\\/increment-variable\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/variables\\\/usage\\\/increment-variable\\\/\",\"url\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/variables\\\/usage\\\/increment-variable\\\/\",\"name\":\"Increment Variable Value in Bash Scripts [4+ Examples] - LinuxSimply\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/variables\\\/usage\\\/increment-variable\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/variables\\\/usage\\\/increment-variable\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2023\\\/09\\\/bash-increment-variable-feature-image.png\",\"datePublished\":\"2023-09-18T09:39:21+00:00\",\"dateModified\":\"2024-02-14T10:04:39+00:00\",\"description\":\"When you want to do a specific task repeatatively for a certain time, you can use the bash increment variable technique for your convenience.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/variables\\\/usage\\\/increment-variable\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/variables\\\/usage\\\/increment-variable\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/variables\\\/usage\\\/increment-variable\\\/#primaryimage\",\"url\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2023\\\/09\\\/bash-increment-variable-feature-image.png\",\"contentUrl\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2023\\\/09\\\/bash-increment-variable-feature-image.png\",\"width\":400,\"height\":400,\"caption\":\"bash increment variable\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/variables\\\/usage\\\/increment-variable\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/linuxsimply.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Bash Scripting Tutorial\",\"item\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Bash Variables\",\"item\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/variables\\\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Using Variables in Bash Scripting\",\"item\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/variables\\\/usage\\\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Increment Variable Value in Bash Scripts [4+ Examples]\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/#website\",\"url\":\"https:\\\/\\\/linuxsimply.com\\\/\",\"name\":\"LinuxSimply\",\"description\":\"All About Linux\",\"publisher\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/linuxsimply.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/#organization\",\"name\":\"LinuxSimply\",\"url\":\"https:\\\/\\\/linuxsimply.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2023\\\/09\\\/LinuxSimply-New-Logo-Without-Icon.png\",\"contentUrl\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2023\\\/09\\\/LinuxSimply-New-Logo-Without-Icon.png\",\"width\":355,\"height\":48,\"caption\":\"LinuxSimply\"},\"image\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/#\\\/schema\\\/person\\\/38abbef9a1053d9faec8935dc39f10fa\",\"name\":\"Susmit Das Gupta\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2023\\\/09\\\/Susmit-Das-Gupta-II-96x96.png\",\"url\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2023\\\/09\\\/Susmit-Das-Gupta-II-96x96.png\",\"contentUrl\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2023\\\/09\\\/Susmit-Das-Gupta-II-96x96.png\",\"caption\":\"Susmit Das Gupta\"},\"description\":\"Hello everyone. I am Susmit Das Gupta, currently working as a Linux Content Developer Executive at SOFTEKO. I am a Mechanical Engineering graduate from Bangladesh University of Engineering and Technology. Besides my routine works, I find interest in going through new things, exploring new places, and capturing landscapes. Read Full Bio\",\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/dasgupta.susmit\",\"https:\\\/\\\/www.instagram.com\\\/susmit_dasgupta\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/susmitdasgupta\\\/\"],\"url\":\"https:\\\/\\\/linuxsimply.com\\\/author\\\/susmit\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Increment Variable Value in Bash Scripts [4+ Examples] - LinuxSimply","description":"When you want to do a specific task repeatatively for a certain time, you can use the bash increment variable technique for your convenience.","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:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/increment-variable\/","og_locale":"en_US","og_type":"article","og_title":"Increment Variable Value in Bash Scripts [4+ Examples] - LinuxSimply","og_description":"When you want to do a specific task repeatatively for a certain time, you can use the bash increment variable technique for your convenience.","og_url":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/increment-variable\/","og_site_name":"LinuxSimply","article_author":"https:\/\/www.facebook.com\/dasgupta.susmit","article_published_time":"2023-09-18T09:39:21+00:00","article_modified_time":"2024-02-14T10:04:39+00:00","og_image":[{"width":400,"height":400,"url":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/bash-increment-variable-feature-image.png","type":"image\/png"}],"author":"Susmit Das Gupta","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Susmit Das Gupta","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/increment-variable\/#article","isPartOf":{"@id":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/increment-variable\/"},"author":{"name":"Susmit Das Gupta","@id":"https:\/\/linuxsimply.com\/#\/schema\/person\/38abbef9a1053d9faec8935dc39f10fa"},"headline":"Increment Variable Value in Bash Scripts [4+ Examples]","datePublished":"2023-09-18T09:39:21+00:00","dateModified":"2024-02-14T10:04:39+00:00","mainEntityOfPage":{"@id":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/increment-variable\/"},"wordCount":1845,"commentCount":0,"publisher":{"@id":"https:\/\/linuxsimply.com\/#organization"},"image":{"@id":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/increment-variable\/#primaryimage"},"thumbnailUrl":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/bash-increment-variable-feature-image.png","keywords":["using variables in bash"],"articleSection":["Bash Scripting"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/increment-variable\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/increment-variable\/","url":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/increment-variable\/","name":"Increment Variable Value in Bash Scripts [4+ Examples] - LinuxSimply","isPartOf":{"@id":"https:\/\/linuxsimply.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/increment-variable\/#primaryimage"},"image":{"@id":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/increment-variable\/#primaryimage"},"thumbnailUrl":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/bash-increment-variable-feature-image.png","datePublished":"2023-09-18T09:39:21+00:00","dateModified":"2024-02-14T10:04:39+00:00","description":"When you want to do a specific task repeatatively for a certain time, you can use the bash increment variable technique for your convenience.","breadcrumb":{"@id":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/increment-variable\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/increment-variable\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/increment-variable\/#primaryimage","url":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/bash-increment-variable-feature-image.png","contentUrl":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/bash-increment-variable-feature-image.png","width":400,"height":400,"caption":"bash increment variable"},{"@type":"BreadcrumbList","@id":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/increment-variable\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/linuxsimply.com\/"},{"@type":"ListItem","position":2,"name":"Bash Scripting Tutorial","item":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/"},{"@type":"ListItem","position":3,"name":"Bash Variables","item":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/"},{"@type":"ListItem","position":4,"name":"Using Variables in Bash Scripting","item":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/variables\/usage\/"},{"@type":"ListItem","position":5,"name":"Increment Variable Value in Bash Scripts [4+ Examples]"}]},{"@type":"WebSite","@id":"https:\/\/linuxsimply.com\/#website","url":"https:\/\/linuxsimply.com\/","name":"LinuxSimply","description":"All About Linux","publisher":{"@id":"https:\/\/linuxsimply.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/linuxsimply.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/linuxsimply.com\/#organization","name":"LinuxSimply","url":"https:\/\/linuxsimply.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/linuxsimply.com\/#\/schema\/logo\/image\/","url":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/LinuxSimply-New-Logo-Without-Icon.png","contentUrl":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/LinuxSimply-New-Logo-Without-Icon.png","width":355,"height":48,"caption":"LinuxSimply"},"image":{"@id":"https:\/\/linuxsimply.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/linuxsimply.com\/#\/schema\/person\/38abbef9a1053d9faec8935dc39f10fa","name":"Susmit Das Gupta","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/Susmit-Das-Gupta-II-96x96.png","url":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/Susmit-Das-Gupta-II-96x96.png","contentUrl":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/Susmit-Das-Gupta-II-96x96.png","caption":"Susmit Das Gupta"},"description":"Hello everyone. I am Susmit Das Gupta, currently working as a Linux Content Developer Executive at SOFTEKO. I am a Mechanical Engineering graduate from Bangladesh University of Engineering and Technology. Besides my routine works, I find interest in going through new things, exploring new places, and capturing landscapes. Read Full Bio","sameAs":["https:\/\/www.facebook.com\/dasgupta.susmit","https:\/\/www.instagram.com\/susmit_dasgupta\/","https:\/\/www.linkedin.com\/in\/susmitdasgupta\/"],"url":"https:\/\/linuxsimply.com\/author\/susmit\/"}]}},"_links":{"self":[{"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/posts\/22183","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/users\/314894"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/comments?post=22183"}],"version-history":[{"count":0,"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/posts\/22183\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/media\/22199"}],"wp:attachment":[{"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/media?parent=22183"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/categories?post=22183"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/tags?post=22183"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}