{"id":34524,"date":"2024-01-17T09:57:00","date_gmt":"2024-01-17T09:57:00","guid":{"rendered":"https:\/\/linuxsimply.com\/?p=34524"},"modified":"2024-03-17T03:25:00","modified_gmt":"2024-03-17T03:25:00","slug":"bash-copy-array","status":"publish","type":"post","link":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/array\/array-operations\/copy-array\/","title":{"rendered":"How to Copy an Array in Bash [6 Simple Methods]"},"content":{"rendered":"<p>You can use the following methods to<strong> copy <\/strong>an<strong> array<\/strong> in Bash:<\/p>\n<ol>\n<li>Using <strong>@<\/strong> within the expression <strong>${array[@]<\/strong>: <code class=\"\" data-line=\"\">copied_array=(&quot;${old_array[@]}&quot;)<\/code><\/li>\n<li>Using <strong>*<\/strong> within the expression <strong>${array[*]<\/strong>: <code class=\"\" data-line=\"\">copied_array=(&quot;${old_array[*]}&quot;)<\/code><\/li>\n<li>By <strong>appending<\/strong> array: <code class=\"\" data-line=\"\">copied_array+=(&quot;${old_array[@]}&quot;)<\/code><\/li>\n<li>Using <strong>array slicing<\/strong> for a partial copy: <code class=\"\" data-line=\"\">sliced_copy=(${old_array[@]:start:count})<\/code><\/li>\n<li>Using the <strong>mapfile<\/strong> command: <code class=\"\" data-line=\"\">mapfile -t copied_array &lt;&lt;&lt;&quot;${old_array[@]}&quot;<\/code><\/li>\n<li>Using <strong>for<\/strong> loop: <code class=\"\" data-line=\"\">for element in &quot;${old_array[@]}&quot;; do<\/code><br \/>\n<code class=\"\" data-line=\"\">copied_array+=(&quot;$element&quot;); done<\/code><\/li>\n<\/ol>\n<p style=\"text-align: justify;\">To copy an array in Bash is to make a duplicate array that is the exact copy of the original array. This involves copying the array elements to a new array-type variable and is particularly significant when it comes to working with the array data but without altering the original array. This article discusses <strong>6<\/strong> effective methods of how to copy an array in Bash including mentioning standard syntax and Bash scripts. Moreover, it shows the copying process of an associative array in Bash.<\/p>\n<div class=\"su-button-center\"><a href=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/bash-copy-array_practice-files.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 Copy Arrays in Bash<\/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\/array\/array-operations\/copy-array\/#6_Ways_to_Copy_an_Array_in_Bash\" >6 Ways to Copy an Array in Bash<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/array\/array-operations\/copy-array\/#1_Using_array_Expression\" >1. Using ${array[@]} Expression<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/array\/array-operations\/copy-array\/#2_Using_array_Expression\" >2. Using ${array[*]} Expression<\/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\/array\/array-operations\/copy-array\/#3_By_Appending_to_Another_Array\" >3. By Appending to Another Array<\/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\/array\/array-operations\/copy-array\/#4_Using_%E2%80%9Cfor%E2%80%9D_Loop\" >4. Using \u201cfor\u201d Loop<\/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\/array\/array-operations\/copy-array\/#5_Using_the_%E2%80%9Cmapfile%E2%80%9D_Command\" >5. Using the \u201cmapfile\u201d Command<\/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\/array\/array-operations\/copy-array\/#6_Using_Array_Slicing_for_Partial_Copy\" >6. Using Array Slicing for Partial Copy<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/array\/array-operations\/copy-array\/#Copy_an_Associative_Array_in_Bash\" >Copy an Associative Array in Bash<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/array\/array-operations\/copy-array\/#Conclusion\" >Conclusion<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/array\/array-operations\/copy-array\/#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-11\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/array\/array-operations\/copy-array\/#How_to_copy_a_Bash_array_using_the_assignment_operator\" >How to copy a Bash array using the assignment operator?<\/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\/array\/array-operations\/copy-array\/#What_is_it_meant_by_copying_a_Bash_array\" >What is it meant by copying a Bash array?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/array\/array-operations\/copy-array\/#Can_I_copy_a_specific_portion_of_an_array_in_Bash\" >Can I copy a specific portion of an array in Bash?<\/a><\/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\/array\/array-operations\/copy-array\/#What_is_the_difference_between_and_notations_in_copying_a_Bash_array\" >What is the difference between @ and * notations in copying a Bash array?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/array\/array-operations\/copy-array\/#How_to_copy_the_values_of_an_associative_array_in_Bash\" >How to copy the values of an associative array in Bash?<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"6_Ways_to_Copy_an_Array_in_Bash\"><\/span>6 Ways to Copy an Array in Bash<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"text-align: justify;\">Copying arrays is a common operation in Bash facilitating data manipulations without affecting the source array ensuring data integrity and data handling flexibility. This section introduces <strong>6 <\/strong>simple yet effective methods regarding how to copy an array in Bash. It mentions <strong>array expression<\/strong> syntax, array <strong>appending<\/strong>, <strong>for<\/strong> loop, and the <strong>mapfile<\/strong> command to copy a <a href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/array\/\" target=\"_blank\" rel=\"noopener\"><strong>Bash array<\/strong><\/a>. Additionally, it sheds light on the <strong>array slicing<\/strong> technique to copy a specific part of an array when necessary in <a href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/\" target=\"_blank\" rel=\"noopener\"><strong>Bash<\/strong><\/a>.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"1_Using_array_Expression\"><\/span>1. Using ${array[@]} Expression<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">The simplest method to copy a Bash array is to use the expression\u00a0 <strong>${array[@]}<\/strong> with the assignment operator, <strong>(=)<\/strong>. The syntax is <code class=\"\" data-line=\"\">copied_array=(&quot;${old_array[@]}&quot;)<\/code> and it expands the <strong>old_array <\/strong>elements and stores them in the <strong>copied_array <\/strong>to make a copy. Here\u2019s an example:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">#!\/bin\/bash\n\n#declare array\nold_array=(&#039;Debian&#039; &#039;Red hat&#039; &#039;Ubuntu&#039; &#039;Suse&#039;)\n\n#array expansion and copy\nclone_array=(&quot;${old_array[@]}&quot;)\n\n#print the 2 Array\necho &quot;original_array: ${old_array[@]}&quot;\necho\necho &quot;copied_array: ${clone_array[@]}&quot;\n<\/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>In the script, after declaring the old_array using <code class=\"\" data-line=\"\">old_array=(&#039;Debian&#039; &#039;Red hat&#039; &#039;Ubuntu&#039; &#039;Suse&#039;)<\/code>, the code <code class=\"\" data-line=\"\">clone_array=(&quot;${old_array[@]}&quot;)<\/code> copies <strong>old_array <\/strong>to <strong>clone_array <\/strong>by expanding each element and storing them in the clone_array which is evident after printing both the original and copied array.<\/div><\/div><img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter size-full wp-image-34527\" src=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/1-arraycopy-exp1.png\" alt=\"bash copy array with @ notation\" width=\"825\" height=\"217\" srcset=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/1-arraycopy-exp1.png 825w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/1-arraycopy-exp1-300x79.png 300w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/1-arraycopy-exp1-768x202.png 768w\" sizes=\"(max-width: 825px) 100vw, 825px\" \/><\/p>\n<h3><span class=\"ez-toc-section\" id=\"2_Using_array_Expression\"><\/span>2. Using ${array[*]} Expression<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">The asterisk <strong>(*)<\/strong> notation is also capable of copying a Bash array when used in the expression <strong>${array[*]}<\/strong> within the complete syntax <code class=\"\" data-line=\"\">array_copy=(&quot;${original_array[*]}&quot;)<\/code>. Below is an example to copy a Bash array using <strong>${array[*]}<\/strong> expression:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">#!\/bin\/bash\n\n#declare array\nfood=(&#039;apple&#039; &#039;banana&#039; &#039;pie&#039; &#039;orange&#039;)\n\n#array expansion and copy using * sign \nfood_clone=(&quot;${food[*]}&quot;)\n\n#print the 2 Arrays to verify copy operation \necho &quot;original_array: ${food[@]}&quot;\necho\necho &quot;copied_array: ${food_clone[@]}&quot;\n<\/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>In the script, the <code class=\"\" data-line=\"\">food_clone=(&quot;${food[*]}&quot;)<\/code> expression expands the array <strong>food <\/strong>as a single string using <code class=\"\" data-line=\"\">${food[*]}<\/code> and copies the array to the duplicate array <strong>food_clone <\/strong>by storing elements as a string. Finally, the echo command prints the 2 arrays to verify that the array has been copied.<\/div><\/div><img decoding=\"async\" class=\"aligncenter size-full wp-image-34528\" src=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/2-arraycopy-exp2.png\" alt=\"bash copy array with * notation\" width=\"825\" height=\"193\" srcset=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/2-arraycopy-exp2.png 825w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/2-arraycopy-exp2-300x70.png 300w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/2-arraycopy-exp2-768x180.png 768w\" sizes=\"(max-width: 825px) 100vw, 825px\" \/><div class=\"su-note\"  style=\"border-color:#cedfe2;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#E8F9FC;border-color:#ffffff;color:#333333;\"><strong>Note:<\/strong> The above expression<code class=\"\" data-line=\"\"> ${array[*]}<\/code> expands the array like <code class=\"\" data-line=\"\">${array[@]}<\/code> but with a difference. It treats all the array elements as a single string to expand and copy the array rather than treating them as individual entities like <code class=\"\" data-line=\"\">${array[@]}\u00a0<\/code>\u00a0 <\/div><\/div>\n<h3><span class=\"ez-toc-section\" id=\"3_By_Appending_to_Another_Array\"><\/span>3. By Appending to Another Array<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">Append to an array in Bash is to add a new element to the end of the array using the shorthand operator <strong>+=<\/strong>. Now, the &#8220;+=&#8221; operator within the syntax <code class=\"\" data-line=\"\">copied_array+=(&quot;${old_array[@]}&quot;)<\/code> easily appends the entire <strong>old_array <\/strong>to the <strong>copied_array <\/strong>which eventually copies the Bash array. Here\u2019s how:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">#!\/bin\/bash\n\n#the original array\nold_array=(&quot;Batman&quot; &quot;IronMan&quot;  &quot;Spiderman&quot;)\n\n#creating empty array to copy old_array\nclone_array=()\n\n#copy old_array to clone_array\nclone_array+=(&quot;${old_array[@]}&quot;)\n\n#print the arrays\necho &quot;original Array:${old_array[@]}&quot;\necho\necho &quot;copied Array:${clone_array[@]}&quot;\n<\/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 above script first declares two arrays named <strong>old_array<\/strong> (full with 3 elements) and <strong>clone_array<\/strong> (empty) using <code class=\"\" data-line=\"\">old_array=(&quot;Batman&quot; &quot;IronMan&quot;\u00a0 &quot;Spiderman&quot;)<\/code> and <code class=\"\" data-line=\"\">clone_array=()<\/code>. Then the notation <code class=\"\" data-line=\"\">clone_array+=(&quot;${old_array[@]}&quot;)<\/code> appends the entire old_array to the clone_array; eventually making a copy of the old_array. <\/div><\/div><img decoding=\"async\" class=\"aligncenter size-full wp-image-34529\" src=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/3-append2copy.png\" alt=\"append to array and copy the array in Bash\" width=\"825\" height=\"160\" srcset=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/3-append2copy.png 825w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/3-append2copy-300x58.png 300w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/3-append2copy-768x149.png 768w\" sizes=\"(max-width: 825px) 100vw, 825px\" \/>As you can see, the above script copies a Bash array by appending it to another array.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"4_Using_%E2%80%9Cfor%E2%80%9D_Loop\"><\/span>4. Using \u201cfor\u201d 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\/for-loop\/\" target=\"_blank\" rel=\"noopener\"><strong>Bash for loop<\/strong><\/a> is a powerful tool to copy an array in Bash through the process of iterating over an array and storing the values in another array variable to make a copy of the original array.<\/p>\n<p>Let\u2019s see an example to see for loop in action to copy an array in Bash:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">#!\/bin\/bash\n\n# Original array\nold_array=(&quot;apple&quot; &quot;banana&quot; &quot;cherry&quot;)\n\n# Initialize an empty array for copying\nclone_array=()\n\n# Iterate over the original array and copy to the new array\nfor element in &quot;${old_array[@]}&quot;; do\n    clone_array+=(&quot;$element&quot;)\ndone\n\n# Display the original and copied arrays\necho &quot;Original Array: ${old_array[@]}&quot;\necho &quot;Copied Array: ${clone_array[@]}&quot;\n<\/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>In the script above, after creating an <a href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/array\/index-array\/\" target=\"_blank\" rel=\"noopener\"><strong>indexed array<\/strong><\/a> named <strong>old_array<\/strong> with 3 elements, the loop <code class=\"\" data-line=\"\">for element in &quot;${old_array[@]}&quot;<\/code> iterates over the old_array and stores the element in another array <strong>clone_array<\/strong>. This iterative approach finally makes a copy of the old_array named clone_array and this is strongly visible after printing the arrays using the <a href=\"https:\/\/linuxsimply.com\/echo-command-in-linux\/#Example_3_Using_the_echo_Command_to_View_Variables_in_the_Command_Line\" target=\"_blank\" rel=\"noopener\"><strong>echo command<\/strong><\/a>.<\/div><\/div><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-34530\" src=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/4-copy-array-for-loop.png\" alt=\"using for loop to copy array \" width=\"825\" height=\"138\" srcset=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/4-copy-array-for-loop.png 825w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/4-copy-array-for-loop-300x50.png 300w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/4-copy-array-for-loop-768x128.png 768w\" sizes=\"(max-width: 825px) 100vw, 825px\" \/>Terminal output states that the <strong>for<\/strong> loop successfully copies an array in Bash.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"5_Using_the_%E2%80%9Cmapfile%E2%80%9D_Command\"><\/span>5. Using the \u201cmapfile\u201d Command<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">The <strong>mapfile<\/strong> command <strong>(<\/strong>also called<strong> readarray)<\/strong> is a handy tool for copying an array in Bash. It is generally used to read lines from a specified standard input into an array variable and assigning an array as its input seamlessly lets the mapfile command copy an array. Here\u2019s how to copy a Bash array using the &#8220;mapfile&#8221; command:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">#!\/bin\/bash\n\n#Original array\nold_array=(&quot;Apple&quot; &quot;Orange&quot; &quot;Banana&quot;)\n\n#Copy array using mapfile\nmapfile -t clone_array &lt;&lt;&lt;&quot;${old_array[@]}&quot;\n\n#Print the arrays\necho &quot;Original Array: ${old_array[@]}&quot;\necho &quot;Copied Array: ${clone_array[@]}&quot;\n<\/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 above script first initializes an array named <strong>old_array <\/strong>with 3 elements: <strong>Apple Orange Banana <\/strong>using <code class=\"\" data-line=\"\">old_array=(&quot;Apple&quot; &quot;Orange&quot; &quot;Banana&quot;)<\/code>. Then the <strong>mapfile <\/strong>command reads lines from its standard input <strong>(<\/strong>which is an array in this case<strong>)<\/strong> and assigns them to a duplicate array named <strong>clone_array<\/strong>. The <strong>-t <\/strong>flag ensures that each element from the original array is assigned to the clone_array to a separate index. Finally, the echo command prints the arrays and verifies the copy operation. <\/div><\/div><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-34533\" src=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/7-copyMapfile.png\" alt=\"bash copy array with mapfile\" width=\"825\" height=\"193\" srcset=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/7-copyMapfile.png 825w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/7-copyMapfile-300x70.png 300w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/7-copyMapfile-768x180.png 768w\" sizes=\"(max-width: 825px) 100vw, 825px\" \/>As you see in the above image, the mapfile command successfully copies an array in Bash.<\/p>\n<div class=\"su-note\"  style=\"border-color:#cedfe2;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#E8F9FC;border-color:#ffffff;color:#333333;\"><strong>Note:<\/strong> If you do not use the <strong>-t<\/strong> flag, the array elements will be accidentally stored as a <strong>single string to the first index<\/strong> of the <strong>clone_array<\/strong> which might not be the desired result. So, be cautious while copying a Bash array using the &#8220;mapfile&#8221; command\u00a0 <\/div><\/div>\n<h3><span class=\"ez-toc-section\" id=\"6_Using_Array_Slicing_for_Partial_Copy\"><\/span>6. Using Array Slicing for Partial Copy<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">Apart from copying an entire array in Bash, copying an array with a specific range of elements might become necessary in data handling and manipulation within arrays. Here, the <strong>array slicing<\/strong> technique is a handy tool to partially copy an array in Bash using the syntax\u00a0 <code class=\"\" data-line=\"\">arr_copy_sliced=(${old_array[@]:start:count})<\/code>.<\/p>\n<p>Here\u2019s an example to partially copy an array in Bash using array slicing:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">#!\/bin\/bash\n\nold_array=(&#039;Debian&#039; &#039;Red hat&#039; &#039;Ubuntu&#039; &#039;Suse&#039; &#039;kali&#039;)\n\n#copy array to another array variable but with array slicing \narr_copy_sliced=(${old_array[@]:1:3})\n\n#print the arrays\n\necho &quot;original array:${old_array[@]}&quot;\necho &quot;sliced_array_copy: ${arr_copy_sliced[@]}&quot;\n<\/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 this script, after the declaration of the <strong>old_array<\/strong> with 5 items using <strong>old_array=(&#8216;Debian&#8217; &#8216;Red hat&#8217; &#8216;Ubuntu&#8217; &#8216;Suse&#8217; &#8216;kali&#8217;)<\/strong>, the array slicing notation <code class=\"\" data-line=\"\">${old_array[@]:1:3}<\/code> begins to slice the array from index 1 <strong>(<\/strong>Red hat<strong>)<\/strong> and continues till it has sliced 3 elements <strong>(<\/strong>Red hat Ubuntu Suse<strong>)<\/strong> from the old_array. The sliced array is stored by the array-type variable <strong>arr_copy_sliced<\/strong> and this effectively copies only partially the old_array to the array arr_copy_sliced. Finally, the copying of the array using the slicing technique is visible after printing the original and copied array. <\/div><\/div><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-34531\" src=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/5-copyPartial.png\" alt=\"array slicing to copy array\" width=\"825\" height=\"161\" srcset=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/5-copyPartial.png 825w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/5-copyPartial-300x59.png 300w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/5-copyPartial-768x150.png 768w\" sizes=\"(max-width: 825px) 100vw, 825px\" \/>The <strong>array slicing<\/strong> method takes an array of 5 elements and copies it partially considering only 3 elements.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Copy_an_Associative_Array_in_Bash\"><\/span>Copy an Associative Array in Bash<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"text-align: justify;\">In Bash, it\u2019s possible to copy an <a href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/array\/associative-array\/\" target=\"_blank\" rel=\"noopener\"><strong>associative array<\/strong><\/a> apart from the indexed array and that too using the for loop. See the below example to copy a Bash associative array using <strong>for<\/strong> loop:<\/p>\n<pre><code class=\"language-bash\" data-line=\"\">#!\/bin\/bash\n\n# Original associative array\ndeclare -A original_array\noriginal_array=([key1]=&quot;value1&quot; [key2]=&quot;value2&quot; [key3]=&quot;value3&quot;)\n\n# Copy the associative array using a loop\ndeclare -A copied_array\nfor key in &quot;${!original_array[@]}&quot;; do\n    copied_array[&quot;$key&quot;]=&quot;${original_array[&quot;$key&quot;]}&quot;\ndone\n\n# Display the original and copied associative arrays\necho &quot;Original Associative Array Values: ${original_array[@]}&quot;\necho &quot;Original Keys: ${!original_array[@]}&quot;\necho\necho &quot;Copied Keys: ${!copied_array[@]}&quot;\necho &quot;Copied Associative Array Values: ${copied_array[@]}&quot;\n<\/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 above script declares an associative array using <code class=\"\" data-line=\"\">declare -A original_array<\/code> and initializes its key-value pairs with <code class=\"\" data-line=\"\">original_array=([key1]=&quot;value1&quot; [key2]=&quot;value2&quot; [key3]=&quot;value3&quot;)<\/code>. Then the loop <code class=\"\" data-line=\"\">for key in &quot;${!original_array[@]}&quot;<\/code> iteratively takes each key of the <strong>original_array <\/strong>and stores the corresponding <strong>key-value pairs<\/strong> to the <strong>copied_array<\/strong>. Finally, after printing the arrays, it\u2019s clear that the for loop successfully copies a Bash associative array.<\/div><\/div><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-34532\" src=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/6-assoc_copy.png\" alt=\"copy associative array in Bash\" width=\"825\" height=\"243\" srcset=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/6-assoc_copy.png 825w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/6-assoc_copy-300x88.png 300w, https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/6-assoc_copy-768x226.png 768w\" sizes=\"(max-width: 825px) 100vw, 825px\" \/>The above states the success of copying an associative array in Bash using <strong>for<\/strong> loops.<\/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;\">This article discusses the concepts of <strong>6<\/strong> effective methods of how to copy an array in Bash. It sheds light on the methods of array appending, array iterations with for loops, the mapfile command, and array slicing to copy Bash arrays to another array variable. Furthermore, it shows how to copy a Bash associative array using for loop. Hope this guide clears your vision on copying Bash arrays ensuring smooth handling and validation of data within arrays without the modification of the source array data.<\/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_to_copy_a_Bash_array_using_the_assignment_operator\"><\/span>How to copy a Bash array using the assignment operator?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\"><strong>To copy an array<\/strong> in Bash using the assignment operator, <strong>(=)<\/strong>, use the syntax <strong>new_array=(&#8220;${old_array[@]}&#8221;)<\/strong>. This will expand the elements of the <strong>old_array <\/strong>and store them in the <strong>new_array <\/strong>variable to make a copy. For instance, <code class=\"\" data-line=\"\">copy_car=(&quot;$CARS{[@]}&quot;)<\/code> will copy the array <strong>CARS <\/strong>to the <strong>copy_car <\/strong>array.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"What_is_it_meant_by_copying_a_Bash_array\"><\/span>What is it meant by copying a Bash array?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\"><strong>Copying an array in Bash<\/strong> means creating a new array containing the same elements as an existing one. This involves duplicating the values of an array to another array and allowing users to work with another instance of the same array without modifying the original. Use the syntax <code class=\"\" data-line=\"\">new_array=(&quot;${old_array[@]}&quot;)<\/code> to simply copy the <strong>old_array <\/strong>to another array called <strong>new_array<\/strong>.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Can_I_copy_a_specific_portion_of_an_array_in_Bash\"><\/span>Can I copy a specific portion of an array in Bash?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\"><strong>Yes<\/strong>, you can. Use the <strong>array slicing<\/strong> technique to fetch specific elements from a large array and store them in another array type variable to <strong>copy a specific portion<\/strong> of an array in Bash. The syntax to use is <strong>sliced_copy=(${original_array[@]:start:count})<\/strong> which copies elements of original_array from the <strong>start <\/strong>index to elements defined by <strong>count<\/strong>. For instance, using the syntax <code class=\"\" data-line=\"\">sliced=(${main[@]:1:4})<\/code> will copy 4 elements of the <strong>main<\/strong> array starting from index 1 and store them in the <strong>slice <\/strong>array.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"What_is_the_difference_between_and_notations_in_copying_a_Bash_array\"><\/span>What is the difference between @ and * notations in copying a Bash array?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">The <strong>@<\/strong> notation within the <strong>${array[@]}<\/strong> expression treats each element of the <strong>array <\/strong>as &#8220;separate words&#8221; when copying the array to another array. It ensures that the elements separated by spaces are preserved as distinct entities. On the other hand, the <strong>*<\/strong> notation in the expression<strong> ${array[*]}<\/strong> treats the entire array as a single stream of string to copy it to another array. It concatenates all the array elements into a single string regardless of spaces.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"How_to_copy_the_values_of_an_associative_array_in_Bash\"><\/span>How to copy the values of an associative array in Bash?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\"><strong>To copy the values<\/strong> of an associative array in Bash, use the notation <strong>${assoc_array[@]}<\/strong> to extract all the values and assign them to a new array with the complete syntax <code class=\"\" data-line=\"\">copied_values=(${assoc_array[@]})<\/code>. In addition, you can use the syntax <code class=\"\" data-line=\"\">copied_keys=(${!assoc_array[@]})<\/code> to copy only the <strong>keys<\/strong> of an associative array to another array.<\/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 to copy a Bash array using the assignment operator?\",\n    \"acceptedAnswer\": {\n      \"@type\": \"Answer\",\n      \"text\": \"To copy an array in Bash using the assignment operator, (=), use the syntax new_array=(\\\"${old_array[@]}\\\"). This will expand the elements of the old_array and store them in the new_array variable to make a copy. For instance, copy_car=(\\\"$CARS{[@]}\\\") will copy the array CARS to the copy_car array.\"\n    }\n  },{\n    \"@type\": \"Question\",\n    \"name\": \"What is it meant by copying a Bash array?\",\n    \"acceptedAnswer\": {\n      \"@type\": \"Answer\",\n      \"text\": \"Copying an array in Bash means creating a new array containing the same elements as an existing one. This involves duplicating the values of an array to another array and allowing users to work with another instance of the same array without modifying the original. Use the syntax new_array=(\\\"${old_array[@]}\\\") to simply copy the old_array to another array called new_array.\"\n    }\n  },{\n    \"@type\": \"Question\",\n    \"name\": \"Can I copy a specific portion of an array in Bash?\",\n    \"acceptedAnswer\": {\n      \"@type\": \"Answer\",\n      \"text\": \"Yes, you can. Use the array slicing technique to fetch specific elements from a large array and store them in another array type variable to copy a specific portion of an array in Bash. The syntax to use is sliced_copy=(${original_array[@]:start:count}) which copies elements of original_array from the start index to elements defined by count. For instance, using the syntax sliced=(${main[@]:1:4}) will copy 4 elements of the main array starting from index 1 and store them in the slice array.\"\n    }\n  },{\n    \"@type\": \"Question\",\n    \"name\": \"What is the difference between @ and * notations in copying a Bash array?\",\n    \"acceptedAnswer\": {\n      \"@type\": \"Answer\",\n      \"text\": \"The @ notation within the ${array[@]} expression treats each element of the array as \\\"separate words\\\" when copying the array to another array. It ensures that the elements separated by spaces are preserved as distinct entities. On the other hand, the * notation in the expression ${array[*]} treats the entire array as a single stream of string to copy it to another array. It concatenates all the array elements into a single string regardless of spaces.\"\n    }\n  },{\n    \"@type\": \"Question\",\n    \"name\": \"How to copy the values of an associative array in Bash?\",\n    \"acceptedAnswer\": {\n      \"@type\": \"Answer\",\n      \"text\": \"To copy the values of an associative array in Bash, use the notation ${assoc_array[@]} to extract all the values and assign them to a new array with the complete syntax copied_values=(${assoc_array[@]}). In addition, you can use the syntax copied_keys=(${!assoc_array[@]}) to copy only the keys of an associative array to another array.\"\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\/array\/array-operations\/json-to-array\/\" target=\"_blank\" rel=\"noopener\">How to Convert a JSON Array into Bash Array [5 Methods]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/array\/array-operations\/array-of-strings-with-spaces\/\" target=\"_blank\" rel=\"noopener\">Master Bash Array of Strings with Spaces [Complete Guide]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/array\/array-operations\/convert-string-to-array\/\" target=\"_blank\" rel=\"noopener\">How to Convert String into Array in Bash [8 Methods]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/array\/array-operations\/array-append\/\" target=\"_blank\" rel=\"noopener\">How to Append to an Array in Bash? [4 Easy Methods]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/array\/array-operations\/clear-array\/\" target=\"_blank\" rel=\"noopener\">How to Clear an Array in Bash [6 Methods]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/array\/array-operations\/filter-array\/\" target=\"_blank\" rel=\"noopener\">How to Filter an Array in Bash? [8 Methods]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/array\/array-operations\/reverse-array\/\" target=\"_blank\" rel=\"noopener\">How to Reverse an Array in Bash? [8 Easy Methods]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/array\/array-operations\/array-slice\/\" target=\"_blank\" rel=\"noopener\">How to Slice an Array in Bash [10 Simple Methods]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/array\/array-operations\/foreach-array\/\" target=\"_blank\" rel=\"noopener\">Iterate Through a Bash Array Using \u201cforeach\u201d Loop [5 Examples]<\/a><\/strong><\/li>\n<li><strong><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/array\/array-operations\/empty-array\/\" target=\"_blank\" rel=\"noopener\">How to Check If an Array is Empty in Bash? [5 Methods]<\/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;Array Operations 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\/array\/array-operations\/\"><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/array\/array-operations\/\" target=\"_blank\" rel=\"noopener\">Array Operations in Bash<\/a><\/span> | <span data-sheets-root=\"1\" data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Bash Array&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\/array\/\"><a class=\"in-cell-link\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/array\/\" target=\"_blank\" rel=\"noopener\">Bash Array<\/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;34524&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;0&quot;,&quot;legendonly&quot;:&quot;&quot;,&quot;readonly&quot;:&quot;&quot;,&quot;score&quot;:&quot;0&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;0\\\/5 - (0 votes)&quot;,&quot;size&quot;:&quot;24&quot;,&quot;title&quot;:&quot;How to Copy an Array in Bash [6 Simple Methods]&quot;,&quot;width&quot;:&quot;0&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: 0px;\">\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            <span class=\"kksr-muted\">Rate this post<\/span>\n    <\/div>\n    <\/div>\n","protected":false},"excerpt":{"rendered":"<p>You can use the following methods to copy an array in Bash: Using @ within the expression ${array[@]: copied_array=(&quot;${old_array[@]}&quot;) Using &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"How to Copy an Array in Bash [6 Simple Methods]\" class=\"read-more button\" href=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/array\/array-operations\/copy-array\/#more-34524\" aria-label=\"Read more about How to Copy an Array in Bash [6 Simple Methods]\">Read more<\/a><\/p>\n","protected":false},"author":314910,"featured_media":34534,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[102],"tags":[180],"class_list":["post-34524","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-bash-scripting","tag-array-operations","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 Copy an Array in Bash [6 Simple Methods]<\/title>\n<meta name=\"description\" content=\"This article discusses 6 effective methods to copy an array in Bash along with mentioning examples by developing bash scripts.\" \/>\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\/array\/array-operations\/copy-array\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Copy an Array in Bash [6 Simple Methods]\" \/>\n<meta property=\"og:description\" content=\"This article discusses 6 effective methods to copy an array in Bash along with mentioning examples by developing bash scripts.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/array\/array-operations\/copy-array\/\" \/>\n<meta property=\"og:site_name\" content=\"LinuxSimply\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/prem.masrur\/\" \/>\n<meta property=\"article:published_time\" content=\"2024-01-17T09:57:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-03-17T03:25:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/8-feature-bash-copy-array.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=\"Md Masrur Ul Alam\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Md Masrur Ul Alam\" \/>\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\\\/array\\\/array-operations\\\/copy-array\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/array\\\/array-operations\\\/copy-array\\\/\"},\"author\":{\"name\":\"Md Masrur Ul Alam\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/#\\\/schema\\\/person\\\/64033dc86d4cd3b6a549cd0ae9e73423\"},\"headline\":\"How to Copy an Array in Bash [6 Simple Methods]\",\"datePublished\":\"2024-01-17T09:57:00+00:00\",\"dateModified\":\"2024-03-17T03:25:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/array\\\/array-operations\\\/copy-array\\\/\"},\"wordCount\":1868,\"commentCount\":3,\"publisher\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/array\\\/array-operations\\\/copy-array\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2024\\\/01\\\/8-feature-bash-copy-array.png\",\"keywords\":[\"array operations\"],\"articleSection\":[\"Bash Scripting\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/array\\\/array-operations\\\/copy-array\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/array\\\/array-operations\\\/copy-array\\\/\",\"url\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/array\\\/array-operations\\\/copy-array\\\/\",\"name\":\"How to Copy an Array in Bash [6 Simple Methods]\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/array\\\/array-operations\\\/copy-array\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/array\\\/array-operations\\\/copy-array\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2024\\\/01\\\/8-feature-bash-copy-array.png\",\"datePublished\":\"2024-01-17T09:57:00+00:00\",\"dateModified\":\"2024-03-17T03:25:00+00:00\",\"description\":\"This article discusses 6 effective methods to copy an array in Bash along with mentioning examples by developing bash scripts.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/array\\\/array-operations\\\/copy-array\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/array\\\/array-operations\\\/copy-array\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/array\\\/array-operations\\\/copy-array\\\/#primaryimage\",\"url\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2024\\\/01\\\/8-feature-bash-copy-array.png\",\"contentUrl\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2024\\\/01\\\/8-feature-bash-copy-array.png\",\"width\":400,\"height\":400,\"caption\":\"bash copy array feature image\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/array\\\/array-operations\\\/copy-array\\\/#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\":\"A Complete Guide to Bash Array\",\"item\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/array\\\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Array Operations in Bash\",\"item\":\"https:\\\/\\\/linuxsimply.com\\\/bash-scripting-tutorial\\\/array\\\/array-operations\\\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"How to Copy an Array in Bash [6 Simple Methods]\"}]},{\"@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\\\/64033dc86d4cd3b6a549cd0ae9e73423\",\"name\":\"Md Masrur Ul Alam\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2023\\\/09\\\/Md-Masrur-Ul-Alam-II-96x96.png\",\"url\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2023\\\/09\\\/Md-Masrur-Ul-Alam-II-96x96.png\",\"contentUrl\":\"https:\\\/\\\/linuxsimply.com\\\/wp-content\\\/uploads\\\/2023\\\/09\\\/Md-Masrur-Ul-Alam-II-96x96.png\",\"caption\":\"Md Masrur Ul Alam\"},\"description\":\"Assalamu Alaikum, I\u2019m Md Masrur Ul Alam, currently working as a Linux OS Content Developer Executive at SOFTEKO. I completed my Bachelor's degree in Electronics and Communication Engineering (ECE)from Khulna University of Engineering &amp; Technology (KUET). With an inquisitive mind, I have always had a keen eye for Science and Technolgy based research and education. I strongly hope this entity leverages the success of my effort in developing engaging yet seasoned content on Linux and contributing to the wealth of technical knowledge. Read Full Bio\",\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/prem.masrur\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/masrur-alam\\\/\"],\"url\":\"https:\\\/\\\/linuxsimply.com\\\/author\\\/masrur\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Copy an Array in Bash [6 Simple Methods]","description":"This article discusses 6 effective methods to copy an array in Bash along with mentioning examples by developing bash scripts.","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\/array\/array-operations\/copy-array\/","og_locale":"en_US","og_type":"article","og_title":"How to Copy an Array in Bash [6 Simple Methods]","og_description":"This article discusses 6 effective methods to copy an array in Bash along with mentioning examples by developing bash scripts.","og_url":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/array\/array-operations\/copy-array\/","og_site_name":"LinuxSimply","article_author":"https:\/\/www.facebook.com\/prem.masrur\/","article_published_time":"2024-01-17T09:57:00+00:00","article_modified_time":"2024-03-17T03:25:00+00:00","og_image":[{"width":400,"height":400,"url":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/8-feature-bash-copy-array.png","type":"image\/png"}],"author":"Md Masrur Ul Alam","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Md Masrur Ul Alam","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/array\/array-operations\/copy-array\/#article","isPartOf":{"@id":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/array\/array-operations\/copy-array\/"},"author":{"name":"Md Masrur Ul Alam","@id":"https:\/\/linuxsimply.com\/#\/schema\/person\/64033dc86d4cd3b6a549cd0ae9e73423"},"headline":"How to Copy an Array in Bash [6 Simple Methods]","datePublished":"2024-01-17T09:57:00+00:00","dateModified":"2024-03-17T03:25:00+00:00","mainEntityOfPage":{"@id":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/array\/array-operations\/copy-array\/"},"wordCount":1868,"commentCount":3,"publisher":{"@id":"https:\/\/linuxsimply.com\/#organization"},"image":{"@id":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/array\/array-operations\/copy-array\/#primaryimage"},"thumbnailUrl":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/8-feature-bash-copy-array.png","keywords":["array operations"],"articleSection":["Bash Scripting"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/linuxsimply.com\/bash-scripting-tutorial\/array\/array-operations\/copy-array\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/array\/array-operations\/copy-array\/","url":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/array\/array-operations\/copy-array\/","name":"How to Copy an Array in Bash [6 Simple Methods]","isPartOf":{"@id":"https:\/\/linuxsimply.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/array\/array-operations\/copy-array\/#primaryimage"},"image":{"@id":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/array\/array-operations\/copy-array\/#primaryimage"},"thumbnailUrl":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/8-feature-bash-copy-array.png","datePublished":"2024-01-17T09:57:00+00:00","dateModified":"2024-03-17T03:25:00+00:00","description":"This article discusses 6 effective methods to copy an array in Bash along with mentioning examples by developing bash scripts.","breadcrumb":{"@id":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/array\/array-operations\/copy-array\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/linuxsimply.com\/bash-scripting-tutorial\/array\/array-operations\/copy-array\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/array\/array-operations\/copy-array\/#primaryimage","url":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/8-feature-bash-copy-array.png","contentUrl":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2024\/01\/8-feature-bash-copy-array.png","width":400,"height":400,"caption":"bash copy array feature image"},{"@type":"BreadcrumbList","@id":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/array\/array-operations\/copy-array\/#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":"A Complete Guide to Bash Array","item":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/array\/"},{"@type":"ListItem","position":4,"name":"Array Operations in Bash","item":"https:\/\/linuxsimply.com\/bash-scripting-tutorial\/array\/array-operations\/"},{"@type":"ListItem","position":5,"name":"How to Copy an Array in Bash [6 Simple Methods]"}]},{"@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\/64033dc86d4cd3b6a549cd0ae9e73423","name":"Md Masrur Ul Alam","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/Md-Masrur-Ul-Alam-II-96x96.png","url":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/Md-Masrur-Ul-Alam-II-96x96.png","contentUrl":"https:\/\/linuxsimply.com\/wp-content\/uploads\/2023\/09\/Md-Masrur-Ul-Alam-II-96x96.png","caption":"Md Masrur Ul Alam"},"description":"Assalamu Alaikum, I\u2019m Md Masrur Ul Alam, currently working as a Linux OS Content Developer Executive at SOFTEKO. I completed my Bachelor's degree in Electronics and Communication Engineering (ECE)from Khulna University of Engineering &amp; Technology (KUET). With an inquisitive mind, I have always had a keen eye for Science and Technolgy based research and education. I strongly hope this entity leverages the success of my effort in developing engaging yet seasoned content on Linux and contributing to the wealth of technical knowledge. Read Full Bio","sameAs":["https:\/\/www.facebook.com\/prem.masrur\/","https:\/\/www.linkedin.com\/in\/masrur-alam\/"],"url":"https:\/\/linuxsimply.com\/author\/masrur\/"}]}},"_links":{"self":[{"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/posts\/34524","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\/314910"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/comments?post=34524"}],"version-history":[{"count":0,"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/posts\/34524\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/media\/34534"}],"wp:attachment":[{"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/media?parent=34524"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/categories?post=34524"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxsimply.com\/wp-json\/wp\/v2\/tags?post=34524"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}