{"id":35569,"date":"2024-01-31T04:48:55","date_gmt":"2024-01-31T04:48:55","guid":{"rendered":"https:\/\/linuxsimply.com\/?p=35569"},"modified":"2024-03-17T05:06:35","modified_gmt":"2024-03-17T05:06:35","slug":"bash-for-seq","status":"publish","type":"post","link":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/bash-seq\/","title":{"rendered":"How to Use Bash \u201cfor\u201d Loop with \u201cseq\u201d Command [10 Examples]"},"content":{"rendered":"<p style=\"text-align: justify;\">Within the realm of Bash scripting, combining the &#8220;for&#8221; loop with the &#8220;seq&#8221; command unlocks robust automation and streamlined numerical manipulation. The &#8220;for&#8221; loop serves as the iterative engine, powering the execution of tasks across a defined sequence of values. In conjunction, the &#8220;seq&#8221; command acts as a generator, efficiently creating these numerical sequences within the loop&#8217;s framework. This article will go through various Bash scripts showcasing the \u201cfor\u201d loop in conjunction with the \u201cseq\u201d command.<\/p>\n<div class=\"su-button-center\"><a href=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/Practice-Files-for-the-Bash-for-Loop-With-the-seq-Command.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 for the Bash \u201cfor\u201d Loop with \u201cseq\u201d Command<\/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\/loop\/for-loop\/bash-seq\/#What_is_the_%E2%80%9Cseq%E2%80%9D_Command_in_Bash\" >What is the &#8220;seq&#8221; Command 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\/loop\/for-loop\/bash-seq\/#10_Examples_of_Using_Bash_%E2%80%9Cfor%E2%80%9D_Loop_with_%E2%80%9Cseq%E2%80%9D_Command\" >10 Examples of Using Bash \u201cfor\u201d Loop with \u201cseq\u201d Command<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/bash-seq\/#1_Iterating_Over_Sequential_Numbers\" >1. Iterating Over Sequential Numbers<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/bash-seq\/#2_Sequential_Number_Ranges\" >2. Sequential Number Ranges<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/bash-seq\/#3_Reverse_Sequential_Number_Ranges\" >3. Reverse Sequential Number Ranges<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/bash-seq\/#4_Step-based_Iteration\" >4. Step-based Iteration<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/bash-seq\/#5_Array_Element\" >5. Array Element<\/a><\/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\/loop\/for-loop\/bash-seq\/#6_Combined_Sequences\" >6. Combined Sequences<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/bash-seq\/#7_Floating-Point_Sequence\" >7. Floating-Point Sequence<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/bash-seq\/#8_Leading_Zero_Sequence\" >8. Leading Zero Sequence<\/a><\/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\/loop\/for-loop\/bash-seq\/#9_Filenames_with_Sequence\" >9. Filenames with Sequence<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/bash-seq\/#10_Hexadecimal_Sequence\" >10. Hexadecimal Sequence<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/bash-seq\/#Practice_Tasks_on_Bash_%E2%80%9Cfor%E2%80%9D_Loop_with_%E2%80%9Cseq%E2%80%9D_Command\" >Practice Tasks on Bash \u201cfor\u201d Loop with \u201cseq\u201d Command<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/bash-seq\/#Conclusion\" >Conclusion<\/a><\/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\/loop\/for-loop\/bash-seq\/#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-16\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/bash-seq\/#How_do_I_create_a_sequence_of_numbers_in_Bash\" >How do I create a sequence of numbers in Bash?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-17\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/bash-seq\/#How_can_a_for_loop_be_used_to_iterate_over_a_range_of_numbers_in_a_bash_script\" >How can a for loop be used to iterate over a range of numbers in a bash script?<\/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\/loop\/for-loop\/bash-seq\/#How_do_you_specify_a_range_in_Linux\" >How do you specify a range in Linux?<\/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\/loop\/for-loop\/bash-seq\/#What_is_the_seq_command_in_the_for_loop\" >What is the seq command in the for loop?<\/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\/loop\/for-loop\/bash-seq\/#What_is_a_for_loop_in_bash\" >What is a for loop in bash?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-21\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/bash-seq\/#How_to_create_an_array_in_Bash\" >How to create an array in Bash?<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"What_is_the_%E2%80%9Cseq%E2%80%9D_Command_in_Bash\"><\/span>What is the &#8220;seq&#8221; Command in Bash?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"text-align: justify;\">The seq command is a specialized tool designed to <strong>generate sequences<\/strong> of numbers in Bash scripting. It is structured to create <strong>numeric ranges<\/strong> based on user-defined parameters. With seq, users can specify the starting and ending points and, optionally the increment or decrement between numbers in the sequence.<\/p>\n<p style=\"text-align: justify;\">The basic syntax of the \u201cseq\u201d command is as follows:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">seq [OPTION]... LAST_VALUE\nseq [OPTION]... FIRST_VALUE LAST_VALUE\nseq [OPTION]... FIRST_VALUE INCREMENT\/DECREMENT LAST_VALUE<\/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>Here,<\/p>\n<p><strong>seq<\/strong>: This command is used to generate sequences of numbers.<\/p>\n<p><strong>OPTION<\/strong>: Optional arguments to customize the behavior of the <strong>seq<\/strong> command.<\/p>\n<p><strong>FIRST_VALUE<\/strong>: This is the first value in the sequence.<\/p>\n<p><strong>LAST_VALUE<\/strong>: This is the last value in the sequence.<\/p>\n<p><strong>INCREMENT\/DECREMENT<\/strong>: This determines how the sequence increments or decrements from the starting value. It can be a positive or negative integer or a floating-point value.<\/p>\n<\/div><\/div>\n<p>The <code class=\"\" data-line=\"\">seq [OPTION]... LAST_VALUE<\/code> syntax generates a sequence of numbers starting from 1 and incrementing by 1 until it reaches the specified LAST_VALUE. While the <code class=\"\" data-line=\"\">seq [OPTION]... FIRST_VALUE LAST_VALUE<\/code> syntax generates a sequence of numbers starting from the provided FIRST_VALUE and incrementing by 1 until it reaches the LAST_VALUE. And the last <code class=\"\" data-line=\"\">seq [OPTION]... FIRST_VALUE INCREMENT\/DECREMENT LAST_VALUE<\/code> generates a sequence starting from FIRST_VALUE and applying the specified INCREMENT\/DECREMENT value to generate the sequence until it reaches LAST_VALUE.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"10_Examples_of_Using_Bash_%E2%80%9Cfor%E2%80%9D_Loop_with_%E2%80%9Cseq%E2%80%9D_Command\"><\/span>10 Examples of Using Bash \u201cfor\u201d Loop with \u201cseq\u201d Command<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"text-align: justify;\">Mastering the <a href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/\" target=\"_blank\" rel=\"noopener\"><strong>for loop<\/strong><\/a> and the &#8220;seq&#8221; command in Bash scripting enables efficient automation and numerical manipulation. This article explores their versatile applications together. This article demonstrates 10 unique practical examples showcasing the alliance between these two components.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"1_Iterating_Over_Sequential_Numbers\"><\/span>1. Iterating Over Sequential Numbers<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">The combination of the Bash &#8216;for&#8217; loop and the &#8216;seq&#8217; command enables efficient iteration over sequential numbers. The following script showcases how to create sequential numbers starting from 1 up to the specified end value:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">#!\/bin\/bash\n\n# Displaying Sequential Numbers\necho &quot;Displaying Sequential Numbers:&quot;\nfor i in $(seq 10); do\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>This script iterates through sequential numbers from 1 to 10 using a Bash &#8220;for&#8221; loop in conjunction with the &#8220;seq&#8221; command. By omitting the starting value in the &#8220;seq&#8221; command, it defaults to 1, incrementing until the specified end value is reached.<\/p>\n<\/div><\/div>\n<p><img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter wp-image-35579 size-full\" src=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/1.-Iterating-Over-Sequential-Numbers.png\" alt=\"Iterating Over Sequential Numbers to print 1 to 10\" width=\"700\" height=\"453\" srcset=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/1.-Iterating-Over-Sequential-Numbers.png 700w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/1.-Iterating-Over-Sequential-Numbers-300x194.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/p>\n<p style=\"text-align: justify;\">Here, 1 to 10 is echoed using just the end value 10.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"2_Sequential_Number_Ranges\"><\/span>2. Sequential Number Ranges<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">The Bash &#8216;for&#8217; loop together with the &#8216;seq&#8217; command efficiently iterates through sequential numbers within a specified range, facilitating various scripting tasks with ease. This script demonstrates how to iterate from 1 to 10, printing each number on a new line:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">#!\/bin\/bash\n\n# Iterating from 1 to 10\necho &quot;Iterating from 1 to 10:&quot;\nfor i in $(seq 1 10); do\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>This Bash script begins by displaying a descriptive message &#8220;Iterating from 1 to 10&#8221;. It then enters a for loop that utilizes the seq command to generate a sequence of numbers from 1 to 10. During each iteration of the loop, the script echoes the current number, printing each number from 1 to 10 on a new line.<\/p>\n<\/div><\/div>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-35580 size-full\" src=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/2.-Sequential-Number-Ranges.png\" alt=\"Sequential Number Ranges to print 1 to 10\" width=\"700\" height=\"446\" srcset=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/2.-Sequential-Number-Ranges.png 700w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/2.-Sequential-Number-Ranges-300x191.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/p>\n<p style=\"text-align: justify;\">Here, a sequence of 1 to 10 is echoed using the seq command.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"3_Reverse_Sequential_Number_Ranges\"><\/span>3. Reverse Sequential Number Ranges<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">With the Bash &#8216;for&#8217; loop and the &#8216;seq&#8217; command, iterating through sequential numbers in reverse order becomes a seamless process. The following script showcases iteration from 10 to 1 with a step size of 2:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">#!\/bin\/bash\n\n# Iterating from 10 to 1\necho &quot;Iterating from 10 to 1:&quot;\nfor i in $(seq 10 -2 1); do\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>This Bash script starts by displaying the message &#8220;Iterating from 10 to 1&#8221;. It then enters a for loop using the seq command, generating a sequence of numbers starting from 10 and decrementing by 2 until it reaches 1. During each iteration, the script echoes the current number, resulting in the printing of numbers from 10 to 1 with a step size of 2.<\/p>\n<\/div><\/div>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-35581 size-full\" src=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/3.-Reverse-Sequential-Number-Ranges.png\" alt=\"Reverse Sequential Number Ranges to print all even number from 10 to 1 using the seq command\" width=\"700\" height=\"266\" srcset=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/3.-Reverse-Sequential-Number-Ranges.png 700w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/3.-Reverse-Sequential-Number-Ranges-300x114.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/p>\n<p style=\"text-align: justify;\">Here, all even numbers are printed from 10 to 1 in reverse order.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"4_Step-based_Iteration\"><\/span>4. Step-based Iteration<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">The &#8216;for&#8217; loop coupled with the &#8216;seq&#8217; command allows for precise step-based iteration through numerical ranges, enhancing the control and efficiency of Bash scripts. This script iterates from 51 to 100 in steps of 10, prints ASCII characters, and then prints floating-point numbers:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">#!\/bin\/bash\n\n# Iterating from 51 to 100 in steps of 10\necho &quot;Iterating from 51 to 100 in steps of 10:&quot;\nfor i in $(seq 51 10 100); do\necho $i\ndone\n\n# Printing ASCII characters\necho &quot;Printing ASCII characters:&quot;\nfor i in $(seq 97 2 103); do\necho $i | awk &#039;{ printf &quot;%c\\n&quot;, $1 }&#039;;\ndone\n\n# Printing floating-point numbers\necho &quot;Printing floating-point numbers:&quot;\nfor i in $(seq .5 .1 .8); do\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>This Bash script performs several tasks sequentially. Firstly, it displays the message &#8220;Iterating from 51 to 100 in steps of 10&#8221;, indicating the range it will iterate through. It then enters a for loop utilizing the \u201cseq\u201d command to generate a sequence from 51 to 100 in increments of 10, printing each number within this range.<\/p>\n<p>Following this, it prints ASCII characters by iterating from 97 to 103 with a step size of 2, converting each numerical value to its corresponding ASCII character using the \u201cawk\u201d command. The <a href=\"https:\/\/linuxsimply.com\/awk-command-in-linux\/\" target=\"_blank\" rel=\"noopener\"><strong>awk command<\/strong><\/a> is a powerful text processing tool primarily used for pattern scanning and text processing.<\/p>\n<p>Lastly, the script prints floating-point numbers ranging from 0.5 to 0.8 with increments of 0.1.<\/p>\n<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-35582 size-full\" src=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/4.-Step-based-Iteration.png\" alt=\"Step-based Iteration using the seq command and for loop\" width=\"700\" height=\"632\" srcset=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/4.-Step-based-Iteration.png 700w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/4.-Step-based-Iteration-300x271.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/p>\n<p style=\"text-align: justify;\">Here, the first sequence of 51 to 100 is printed with a step size of 10. Then ASCII characters are echoed from their equivalent ASCII number. Lastly, a floating point sequence is generated.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"5_Array_Element\"><\/span>5. Array Element<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">Utilizing the &#8216;seq&#8217; command within the &#8216;for&#8217; loop simplifies sequential array element access, streamlining array manipulation tasks in Bash scripts. The following script displays indices and elements of an array using the &#8216;seq&#8217; command:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">#!\/bin\/bash\n\nfruits=(&quot;Apple&quot; &quot;Banana&quot; &quot;Orange&quot; &quot;Grapes&quot;)\nfor i in $(seq 0 $((${#fruits[@]} - 1))); do\necho &quot;$i : ${fruits[$i]}&quot;\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>This Bash script utilizes the \u201cseq\u201d command within a for loop to generate a sequence of numbers representing the indices of the fruits array. The \u201cseq\u201d command generates a sequence starting from 0 and ending at the length of the array minus 1, ensuring that the loop iterates over each index of the array. This sequence of numbers determines the indices accessed during each iteration of the loop, allowing the script to access and print the corresponding elements of the fruits array.<\/p>\n<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-35583 size-full\" src=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/5.-Array-Element.png\" alt=\"Array Element iteration using the seq command and for loop\" width=\"700\" height=\"192\" srcset=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/5.-Array-Element.png 700w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/5.-Array-Element-300x82.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/p>\n<p style=\"text-align: justify;\">Here, array elements are echoed using the seq command.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"6_Combined_Sequences\"><\/span>6. Combined Sequences<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">Integrating multiple sequences within the &#8216;for&#8217; loop using the &#8216;seq&#8217; command empowers Bash scripts to generate complex numerical patterns efficiently. The following script combines two sequences to create a unique pattern:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">#!\/bin\/bash\n\n# Combined Sequences\necho &quot;Combined Sequences:&quot;\nfor i in $(seq 0 5 25; seq 50 5 75); do\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>This Bash script first prints the message &#8220;Combined Sequences&#8221;. It then utilizes the &#8216;seq&#8217; command twice within a single &#8216;for&#8217; loop to generate two distinct sequences: one starting from 0 and incrementing by 5 until reaching 25, and another starting from 50 and incrementing by 5 until reaching 75. During each iteration of the loop, the script prints the current value of the combined sequence, displaying numbers from both sequences sequentially.<\/p>\n<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-35584 size-full\" src=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/6.-Combined-Sequences.png\" alt=\"Combined 2 separate Sequences in a for loop\" width=\"700\" height=\"519\" srcset=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/6.-Combined-Sequences.png 700w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/6.-Combined-Sequences-300x222.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/p>\n<p style=\"text-align: justify;\">Here, 2 separate sequences are merged.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"7_Floating-Point_Sequence\"><\/span>7. Floating-Point Sequence<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">With the &#8216;seq&#8217; command and the &#8216;for&#8217; loop, Bash scripts can generate precise floating-point sequences, facilitating accurate numerical calculations. This script demonstrates the creation of a floating-point sequence using the <code class=\"\" data-line=\"\">-f<\/code> option, which allows for precise control over the output format of the sequence:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">#!\/bin\/bash\n\necho &quot;Floating-Point Sequence:&quot;\nfor i in $(seq -f &#039;%f&#039; 5); do\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>This Bash script begins by displaying the message &#8220;Floating-Point Sequence&#8221;. It utilizes the seq command with the <code class=\"\" data-line=\"\">-f<\/code> option to generate a sequence of floating-point numbers starting from 1 and ending at 5. During each iteration of the loop, the script prints the current floating-point number, allowing for precise control over the output format of the sequence.<\/p>\n<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-35585 size-full\" src=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/7.-Floating-Point-Sequence.png\" alt=\"Floating-Point Sequence output\" width=\"700\" height=\"264\" srcset=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/7.-Floating-Point-Sequence.png 700w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/7.-Floating-Point-Sequence-300x113.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/p>\n<p style=\"text-align: justify;\">Here, a sequence with the floating value is echoed.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"8_Leading_Zero_Sequence\"><\/span>8. Leading Zero Sequence<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">The <code class=\"\" data-line=\"\">-w<\/code> option of the &#8216;seq&#8217; command simplifies the generation of sequences with leading zeros, ensuring consistent formatting and presentation of numerical data. The following script generates a sequence with leading zeros using the <code class=\"\" data-line=\"\">-w<\/code> option:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">#!\/bin\/bash\n\necho &quot;Leading Zero Sequence:&quot;\nfor i in $(seq -w 5 4 15); do\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>This Bash script starts by printing the message &#8220;Leading Zero Sequence&#8221;. It employs the seq command with the <code class=\"\" data-line=\"\">-w<\/code> option to generate a sequence with leading zeros. The sequence begins from 05 and increments by 4 until it reaches 15. During each iteration, the script prints the current value of the sequence, ensuring that numbers with leading zeros are displayed consistently.<\/p>\n<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-35586 size-full\" src=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/8.-Leading-Zero-Sequence.png\" alt=\"sequence with Leading Zero\" width=\"700\" height=\"190\" srcset=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/8.-Leading-Zero-Sequence.png 700w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/8.-Leading-Zero-Sequence-300x81.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/p>\n<p style=\"text-align: justify;\">Here, a seq is generated with the leading zero.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"9_Filenames_with_Sequence\"><\/span>9. Filenames with Sequence<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">Integrating the &#8216;seq&#8217; command into filename generation processes enables Bash scripts to dynamically create and manage filenames with sequential numbering, enhancing file management capabilities. This script creates filenames with a sequential numbering pattern using the <code class=\"\" data-line=\"\">-s<\/code> option to specify the separator between numbers:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">#!\/bin\/bash\n\necho &quot;Filenames with Sequence:&quot;\nfor i in logfile-$( seq -s &#039;.log logfile-&#039; 3 ).log; do\necho -n &quot;$i; &quot;;\ndone\n\necho<\/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>This Bash script starts by displaying the message &#8220;Filenames with Sequence&#8221;. It utilizes the seq command within a <strong>command substitution<\/strong> <code class=\"\" data-line=\"\">$(...)<\/code> to generate a sequence of numbers separated by &#8216;.log logfile-&#8216;. The generated sequence is then used to create filenames with the format &#8216;logfile-n.log&#8217;, where &#8216;n&#8217; is each number in the sequence. Finally, during each iteration of the loop, the script prints the generated filenames separated by semicolons.<\/p>\n<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-35587 size-full\" src=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/9.-Filenames-with-Sequence.png\" alt=\"Filenames generation using the seq command and for loop\" width=\"700\" height=\"116\" srcset=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/9.-Filenames-with-Sequence.png 700w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/9.-Filenames-with-Sequence-300x50.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/p>\n<p style=\"text-align: justify;\">Here, file names are generated using the seq command.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"10_Hexadecimal_Sequence\"><\/span>10. Hexadecimal Sequence<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">The &#8216;seq&#8217; command, when combined with the &#8216;for&#8217; loop, enables Bash scripts to process hexadecimal sequences effortlessly, facilitating tasks involving hexadecimal numerical representation. The following script generates a sequence using the hexadecimal numbers using the \u201cseq\u201d command:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">#!\/bin\/bash\n\necho &quot;Hexadecimal Sequence:&quot;\nfor i in $( seq 0x2B 0xA 0x6C ); do\necho -n &quot;$i; &quot;;\ndone\n\necho<\/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>This Bash script starts by printing the message &#8220;Hexadecimal Sequence&#8221;. It utilizes the seq command to generate a sequence of hexadecimal numbers starting from 0x2B and incrementing by 0xA until it reaches 0x6C. During each iteration of the loop, the script prints the current hexadecimal number followed by a semicolon, displaying the sequence of hexadecimal values.<\/p>\n<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-35588 size-full\" src=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/10.-Hexadecimal-Sequence.png\" alt=\"Sequence generation using Hexadecimal number\" width=\"700\" height=\"183\" srcset=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/10.-Hexadecimal-Sequence.png 700w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/10.-Hexadecimal-Sequence-300x78.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/p>\n<p style=\"text-align: justify;\">Here, a sequence is generated using hexadecimal numbers.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Practice_Tasks_on_Bash_%E2%80%9Cfor%E2%80%9D_Loop_with_%E2%80%9Cseq%E2%80%9D_Command\"><\/span>Practice Tasks on Bash \u201cfor\u201d Loop with \u201cseq\u201d Command<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"text-align: justify;\">If you aim to be better at using the \u201cseq\u201d command in the \u201cfor\u201d loop then you can try solving the following problems using the concept discussed in this article:<\/p>\n<ol>\n<li style=\"text-align: justify;\">Write a Bash script that uses a &#8220;for&#8221; loop and the &#8220;seq&#8221; command to print sequential numbers from 1 to 10.<\/li>\n<li style=\"text-align: justify;\">Create a Bash script that prints numbers from 10 to 1 in reverse order using the &#8220;seq&#8221; command and a &#8220;for&#8221; loop.<\/li>\n<li style=\"text-align: justify;\">Create a Bash script that prints multiples of 3 from 3 to 30 using the &#8220;seq&#8221; command and a &#8220;for&#8221; loop.<\/li>\n<li style=\"text-align: justify;\">Write a Bash script to calculate the factorial of a given number using the &#8220;seq&#8221; command and a &#8220;for&#8221; loop.<\/li>\n<li style=\"text-align: justify;\">Implement a Bash script to print all prime numbers between 1 and 100 using the &#8220;seq&#8221; command and a &#8220;for&#8221; loop.<\/li>\n<\/ol>\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;\">Exploring the Bash &#8220;for&#8221; loop and the &#8220;seq&#8221; command opens up a world of possibilities in script automation. By understanding how to leverage these tools effectively, you can streamline your workflow and tackle complex tasks with ease. I hope you find this article helpful in your Bash scripting journey.<\/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_I_create_a_sequence_of_numbers_in_Bash\"><\/span>How do I create a sequence of numbers in Bash?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">To create a sequence of numbers in bash you can use the seq command which is specifically designed for generating sequences. The basic syntax of the seq command is <code class=\"\" data-line=\"\">seq [OPTION]... LAST_VALUE<\/code>, where you specify the starting and ending points of the sequence. Additionally, you can include an increment or decrement between numbers by using the syntax <code class=\"\" data-line=\"\">seq [OPTION]... FIRST_VALUE INCREMENT\/DECREMENT LAST_VALUE<\/code>. This command is versatile and allows you to generate sequences of numbers efficiently for various scripting tasks in the bash environment.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"How_can_a_for_loop_be_used_to_iterate_over_a_range_of_numbers_in_a_bash_script\"><\/span>How can a for loop be used to iterate over a range of numbers in a bash script?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">To iterate over a range of numbers in a bash script, a for loop can be utilized with the seq command. The seq command generates a number sequence for the for loop to iterate over. Users specify the starting and ending points and determine how the sequence progresses. This functionality enables the for loop to navigate through numbers and perform tasks accordingly. This approach provides a flexible and efficient method for performing repetitive tasks involving numerical sequences in bash scripting.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"How_do_you_specify_a_range_in_Linux\"><\/span>How do you specify a range in Linux?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">To specify a range in linux, you can use various commands and syntax depending on the context. For numerical ranges, the seq command is commonly used. You can generate number sequences by setting the start and end values and optionally the step between numbers. These sequences are useful for various tasks, including data processing or file operations. Commands like <a href=\"https:\/\/linuxsimply.com\/grep-command-in-linux\/\" target=\"_blank\" rel=\"noopener\"><strong>grep<\/strong><\/a>, awk, or <a href=\"https:\/\/linuxsimply.com\/sed-command-in-linux\/\" target=\"_blank\" rel=\"noopener\"><strong>sed<\/strong><\/a> also support range specifications for filtering or manipulating data.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"What_is_the_seq_command_in_the_for_loop\"><\/span>What is the seq command in the for loop?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">The seq command in the for loop is a Bash utility used to generate sequences of numbers. It is designed to create numeric ranges based on specified parameters. The seq command helps define the start and end of a sequence, along with the step between numbers. It&#8217;s handy for looping through number ranges in bash scripts, making tasks with numerical sequences easier to automate. Using seq simplifies iterating through numbers in bash scripts.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"What_is_a_for_loop_in_bash\"><\/span>What is a for loop in bash?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">A for loop is a control structure in bash scripting that allows for repetitive execution of a block of commands based on a specified list of items. It iterates through each item in the list and executes the commands within the loop for each item. A for loop typically contains the keyword &#8220;for&#8221; and a variable that represents items in the list. It also includes the list itself and commands to execute within the loop. It can iterate through numbers, filenames, or array elements, offering a powerful automation tool in bash scripts.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"How_to_create_an_array_in_Bash\"><\/span>How to create an array in Bash?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">To create an array in Bash, you declare a variable and assign values to it within parentheses, separated by spaces. For example <code class=\"\" data-line=\"\">myArray=(\u201capple\u201d \u201cbanana\u201d \u201corange\u201d)<\/code>. You can access individual elements using their <strong>index<\/strong>, starting from <strong>zero<\/strong>: <code class=\"\" data-line=\"\">echo myArray[0]<\/code>. Arrays in Bash allow you to store and manipulate collections of data efficiently within your scripts.<\/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 I create a sequence of numbers in Bash?\",\n    \"acceptedAnswer\": {\n      \"@type\": \"Answer\",\n      \"text\": \"To create a sequence of numbers in bash you can use the seq command which is specifically designed for generating sequences.<\/yoastmark> The basic syntax of the seq command is seq [OPTION]... LAST_VALUE, where you specify the starting and ending points of the sequence. Additionally, you can include an increment or decrement between numbers by using the syntax seq [OPTION]... FIRST_VALUE INCREMENT\/DECREMENT LAST_VALUE. This command is versatile and allows you to generate sequences of numbers efficiently for various scripting tasks in the bash environment.\"\n    }\n  },{\n    \"@type\": \"Question\",\n    \"name\": \"How can a for loop be used to iterate over a range of numbers in a bash script?\",\n    \"acceptedAnswer\": {\n      \"@type\": \"Answer\",\n      \"text\": \"To iterate over a range of numbers in a bash script, a for loop can be utilized with the seq command. The seq command generates a number sequence for the for loop to iterate over. Users specify the starting and ending points and determine how the sequence progresses. This functionality enables the for loop to navigate through numbers and perform tasks accordingly.<\/yoastmark> This approach provides a flexible and efficient method for performing repetitive tasks involving numerical sequences in bash scripting.\"\n    }\n  },{\n    \"@type\": \"Question\",\n    \"name\": \"How do you specify a range in Linux?\",\n    \"acceptedAnswer\": {\n      \"@type\": \"Answer\",\n      \"text\": \"To specify a range in linux, you can use various commands and syntax depending on the context. For numerical ranges, the seq command is commonly used. You can generate number sequences by setting the start and end values and optionally the step between numbers. These sequences are useful for various tasks, including data processing or file operations. Commands like grep, awk, or sed also support range specifications for filtering or manipulating data.\"\n    }\n  },{\n    \"@type\": \"Question\",\n    \"name\": \"What is the seq command in the for loop?\",\n    \"acceptedAnswer\": {\n      \"@type\": \"Answer\",\n      \"text\": \"The seq command in the for loop is a Bash utility used to generate sequences of numbers. It is designed to create numeric ranges based on specified parameters. The seq command helps define the start and end of a sequence, along with the step between numbers. It's handy for looping through number ranges in bash scripts, making tasks with numerical sequences easier to automate. Using seq simplifies iterating through numbers in bash scripts.\"\n    }\n  },{\n    \"@type\": \"Question\",\n    \"name\": \"What is a for loop in bash?\",\n    \"acceptedAnswer\": {\n      \"@type\": \"Answer\",\n      \"text\": \"A for loop is a control structure in bash scripting that allows for repetitive execution of a block of commands based on a specified list of items. It iterates through each item in the list and executes the commands within the loop for each item. A for loop typically contains the keyword \\\"for\\\" and a variable that represents items in the list. It also includes the list itself and commands to execute within the loop. It can iterate through numbers, filenames, or array elements, offering a powerful automation tool in bash scripts.\"\n    }\n  },{\n    \"@type\": \"Question\",\n    \"name\": \"How to create an array in Bash?\",\n    \"acceptedAnswer\": {\n      \"@type\": \"Answer\",\n      \"text\": \"To create an array in Bash, you declare a variable and assign values to it within parentheses, separated by spaces. For example myArray=(\u201capple\u201d \u201cbanana\u201d \u201corange\u201d). You can access individual elements using their index, starting from zero: echo myArray[0]. Arrays in Bash allow you to store and manipulate collections of data efficiently within your scripts.\"\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\/loop\/for-loop\/for-loop-example\/\" target=\"_blank\" rel=\"noopener\">10 Common Bash \u201cfor\u201d Loop Examples [Basic to Intermediate]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/for-loop-list\/\" target=\"_blank\" rel=\"noopener\">How to Iterate Through List Using \u201cfor\u201d Loop in Bash<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/for-loop-with-variable\/\" target=\"_blank\" rel=\"noopener\">How to Use Bash \u201cfor\u201d Loop with Variable [12 Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/increment-variable\/\" target=\"_blank\" rel=\"noopener\">Bash Increment and Decrement Variable in \u201cfor\u201d Loop<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/parallel-for-loop\/\" target=\"_blank\" rel=\"noopener\">How to Use Bash Parallel \u201cfor\u201d Loop [7 Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/for-array\/\" target=\"_blank\" rel=\"noopener\">How to Loop Through Array Using \u201cfor\u201d Loop in Bash<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/range\/\" target=\"_blank\" rel=\"noopener\">How to Use Bash \u201cfor\u201d Loop with Range [5 Methods]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/files\/\" target=\"_blank\" rel=\"noopener\">How to Use &#8220;for&#8221; Loop in Bash Files [9 Practical Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/directory\/\" target=\"_blank\" rel=\"noopener\">Usage of \u201cfor\u201d Loop in Bash Directory [5 Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/one-line\/\" target=\"_blank\" rel=\"noopener\">How to Use \u201cfor\u201d Loop in One Line in Bash [7 Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/nested-for-loop\/\" target=\"_blank\" rel=\"noopener\">How to Use Nested \u201cfor\u201d Loop in Bash [7 Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/infinite-loop\/\" target=\"_blank\" rel=\"noopener\">How to Create Infinite Loop in Bash [7 Cases]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/for-loop-continue\/\" target=\"_blank\" rel=\"noopener\">How to Use Bash Continue with \u201cfor\u201d Loop [9 Examples]<\/a><\/strong><\/li>\n<\/ul>\n<hr \/>\n<p><strong>&lt;&lt; Go Back to <span data-sheets-root=\"1\" data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;For Loop in Bash&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\/loop\/for-loop\/\"><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/\" target=\"_blank\" rel=\"noopener\">For Loop in Bash<\/a> |\u00a0<\/span><span data-sheets-root=\"1\" data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Loops in Bash&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\/loop\/\"><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/\" target=\"_blank\" rel=\"noopener\">Loops in Bash<\/a><\/span> | <span data-sheets-root=\"1\" 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;35569&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;How to Use Bash \u201cfor\u201d Loop with \u201cseq\u201d Command [10 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>Within the realm of Bash scripting, combining the &#8220;for&#8221; loop with the &#8220;seq&#8221; command unlocks robust automation and streamlined numerical &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"How to Use Bash \u201cfor\u201d Loop with \u201cseq\u201d Command [10 Examples]\" class=\"read-more button\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/bash-seq\/#more-35569\" aria-label=\"Read more about How to Use Bash \u201cfor\u201d Loop with \u201cseq\u201d Command [10 Examples]\">Read more<\/a><\/p>\n","protected":false},"author":314909,"featured_media":35589,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[102],"tags":[175],"class_list":["post-35569","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-bash-scripting","tag-for-loop","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>How to Use Bash \u201cfor\u201d Loop with \u201cseq\u201d Command [10 Examples] - LinuxSimply<\/title>\n<meta name=\"description\" content=\"In Bash scripting, How to use the &quot;for&quot; loop in conjunction with the &quot;seq&quot; command to dynamacilly generate sequence and iterate over that.\" \/>\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\/loop\/for-loop\/bash-seq\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Use Bash \u201cfor\u201d Loop with \u201cseq\u201d Command [10 Examples] - LinuxSimply\" \/>\n<meta property=\"og:description\" content=\"In Bash scripting, How to use the &quot;for&quot; loop in conjunction with the &quot;seq&quot; command to dynamacilly generate sequence and iterate over that.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/bash-seq\/\" \/>\n<meta property=\"og:site_name\" content=\"LinuxSimply\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/ridoychandra.shil.9\" \/>\n<meta property=\"article:published_time\" content=\"2024-01-31T04:48:55+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-03-17T05:06:35+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/bash-for-seq-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=\"Ridoy Chandra Shil\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ridoy Chandra Shil\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"13 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\\\/loop\\\/for-loop\\\/bash-seq\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/loop\\\/for-loop\\\/bash-seq\\\/\"},\"author\":{\"name\":\"Ridoy Chandra Shil\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/#\\\/schema\\\/person\\\/94793d6ad5334004f864932ed89e58b4\"},\"headline\":\"How to Use Bash \u201cfor\u201d Loop with \u201cseq\u201d Command [10 Examples]\",\"datePublished\":\"2024-01-31T04:48:55+00:00\",\"dateModified\":\"2024-03-17T05:06:35+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/loop\\\/for-loop\\\/bash-seq\\\/\"},\"wordCount\":2496,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/loop\\\/for-loop\\\/bash-seq\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2024\\\/01\\\/bash-for-seq-feature-image.png\",\"keywords\":[\"for loop\"],\"articleSection\":[\"Bash Scripting\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/loop\\\/for-loop\\\/bash-seq\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/loop\\\/for-loop\\\/bash-seq\\\/\",\"url\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/loop\\\/for-loop\\\/bash-seq\\\/\",\"name\":\"How to Use Bash \u201cfor\u201d Loop with \u201cseq\u201d Command [10 Examples] - LinuxSimply\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/loop\\\/for-loop\\\/bash-seq\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/loop\\\/for-loop\\\/bash-seq\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2024\\\/01\\\/bash-for-seq-feature-image.png\",\"datePublished\":\"2024-01-31T04:48:55+00:00\",\"dateModified\":\"2024-03-17T05:06:35+00:00\",\"description\":\"In Bash scripting, How to use the \\\"for\\\" loop in conjunction with the \\\"seq\\\" command to dynamacilly generate sequence and iterate over that.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/loop\\\/for-loop\\\/bash-seq\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/loop\\\/for-loop\\\/bash-seq\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/loop\\\/for-loop\\\/bash-seq\\\/#primaryimage\",\"url\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2024\\\/01\\\/bash-for-seq-feature-image.png\",\"contentUrl\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2024\\\/01\\\/bash-for-seq-feature-image.png\",\"width\":400,\"height\":400,\"caption\":\"In Bash scripting, How to use the \\\"for\\\" loop in conjunction with the \\\"seq\\\" command to dynamacilly generate sequence and iterate over that.\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/loop\\\/for-loop\\\/bash-seq\\\/#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\":\"Loops in Bash\",\"item\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/loop\\\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"For Loop in Bash\",\"item\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/loop\\\/for-loop\\\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"How to Use Bash \u201cfor\u201d Loop with \u201cseq\u201d Command [10 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\\\/94793d6ad5334004f864932ed89e58b4\",\"name\":\"Ridoy Chandra Shil\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2023\\\/09\\\/Ridoy-Chandra-Shil-II-96x96.png\",\"url\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2023\\\/09\\\/Ridoy-Chandra-Shil-II-96x96.png\",\"contentUrl\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2023\\\/09\\\/Ridoy-Chandra-Shil-II-96x96.png\",\"caption\":\"Ridoy Chandra Shil\"},\"description\":\"Hello everyone. I am Ridoy Chandra Shil, currently working as a Linux Content Developer Executive at SOFTEKO. I am a Biomedical Engineering graduate from Bangladesh University of Engineering and Technology. I am a science and tech enthusiast. In my free time, I read articles about new tech and watch documentaries on science-related topics. I am also a big fan of \u201cThe Big Bang Theory\u201d. Read Full Bio\",\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/ridoychandra.shil.9\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/ridoy-chandra-shil\\\/\"],\"url\":\"https:\\\/\\\/linuxsimply.com\\\/author\\\/ridoy\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Use Bash \u201cfor\u201d Loop with \u201cseq\u201d Command [10 Examples] - LinuxSimply","description":"In Bash scripting, How to use the \"for\" loop in conjunction with the \"seq\" command to dynamacilly generate sequence and iterate over that.","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\/loop\/for-loop\/bash-seq\/","og_locale":"en_US","og_type":"article","og_title":"How to Use Bash \u201cfor\u201d Loop with \u201cseq\u201d Command [10 Examples] - LinuxSimply","og_description":"In Bash scripting, How to use the \"for\" loop in conjunction with the \"seq\" command to dynamacilly generate sequence and iterate over that.","og_url":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/bash-seq\/","og_site_name":"LinuxSimply","article_author":"https:\/\/www.facebook.com\/ridoychandra.shil.9","article_published_time":"2024-01-31T04:48:55+00:00","article_modified_time":"2024-03-17T05:06:35+00:00","og_image":[{"width":400,"height":400,"url":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/bash-for-seq-feature-image.png","type":"image\/png"}],"author":"Ridoy Chandra Shil","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Ridoy Chandra Shil","Est. reading time":"13 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/bash-seq\/#article","isPartOf":{"@id":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/bash-seq\/"},"author":{"name":"Ridoy Chandra Shil","@id":"https:\/\/linuxsimply.com\/#\/schema\/person\/94793d6ad5334004f864932ed89e58b4"},"headline":"How to Use Bash \u201cfor\u201d Loop with \u201cseq\u201d Command [10 Examples]","datePublished":"2024-01-31T04:48:55+00:00","dateModified":"2024-03-17T05:06:35+00:00","mainEntityOfPage":{"@id":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/bash-seq\/"},"wordCount":2496,"commentCount":0,"publisher":{"@id":"https:\/\/linuxsimply.com\/#organization"},"image":{"@id":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/bash-seq\/#primaryimage"},"thumbnailUrl":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/bash-for-seq-feature-image.png","keywords":["for loop"],"articleSection":["Bash Scripting"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/bash-seq\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/bash-seq\/","url":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/bash-seq\/","name":"How to Use Bash \u201cfor\u201d Loop with \u201cseq\u201d Command [10 Examples] - LinuxSimply","isPartOf":{"@id":"https:\/\/linuxsimply.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/bash-seq\/#primaryimage"},"image":{"@id":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/bash-seq\/#primaryimage"},"thumbnailUrl":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/bash-for-seq-feature-image.png","datePublished":"2024-01-31T04:48:55+00:00","dateModified":"2024-03-17T05:06:35+00:00","description":"In Bash scripting, How to use the \"for\" loop in conjunction with the \"seq\" command to dynamacilly generate sequence and iterate over that.","breadcrumb":{"@id":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/bash-seq\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/bash-seq\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/bash-seq\/#primaryimage","url":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/bash-for-seq-feature-image.png","contentUrl":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/bash-for-seq-feature-image.png","width":400,"height":400,"caption":"In Bash scripting, How to use the \"for\" loop in conjunction with the \"seq\" command to dynamacilly generate sequence and iterate over that."},{"@type":"BreadcrumbList","@id":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/bash-seq\/#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":"Loops in Bash","item":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/"},{"@type":"ListItem","position":4,"name":"For Loop in Bash","item":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/loop\/for-loop\/"},{"@type":"ListItem","position":5,"name":"How to Use Bash \u201cfor\u201d Loop with \u201cseq\u201d Command [10 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\/94793d6ad5334004f864932ed89e58b4","name":"Ridoy Chandra Shil","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/Ridoy-Chandra-Shil-II-96x96.png","url":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/Ridoy-Chandra-Shil-II-96x96.png","contentUrl":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/Ridoy-Chandra-Shil-II-96x96.png","caption":"Ridoy Chandra Shil"},"description":"Hello everyone. I am Ridoy Chandra Shil, currently working as a Linux Content Developer Executive at SOFTEKO. I am a Biomedical Engineering graduate from Bangladesh University of Engineering and Technology. I am a science and tech enthusiast. In my free time, I read articles about new tech and watch documentaries on science-related topics. I am also a big fan of \u201cThe Big Bang Theory\u201d. Read Full Bio","sameAs":["https:\/\/www.facebook.com\/ridoychandra.shil.9","https:\/\/www.linkedin.com\/in\/ridoy-chandra-shil\/"],"url":"https:\/\/linuxsimply.com\/author\/ridoy\/"}]}},"_links":{"self":[{"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/posts\/35569","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\/314909"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/comments?post=35569"}],"version-history":[{"count":0,"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/posts\/35569\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/media\/35589"}],"wp:attachment":[{"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/media?parent=35569"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/categories?post=35569"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/tags?post=35569"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}