Merge branch 'dev' of feistymeow.org:feisty_meow into release-2.140.94
[feisty_meow.git] / infobase / examples / bashisms / it_is_possible_to_cleanly_copy_array_elems.txt
diff --git a/infobase/examples/bashisms/it_is_possible_to_cleanly_copy_array_elems.txt b/infobase/examples/bashisms/it_is_possible_to_cleanly_copy_array_elems.txt
new file mode 100644 (file)
index 0000000..8be73c9
--- /dev/null
@@ -0,0 +1,16 @@
+
+
+# when the array elements have spaces, it is still possible to get them back right.
+
+
+a=("ted row" "boon" "moopy dongle")
+echo ${#a[@]}
+# 3
+borg=( "${a[@]}" )
+echo ${#borg[@]}
+# 3
+
+# normally the setting of borg would not preserve the elements with spaces in them as separate.
+# but by using the @ to get all the array members and the spaces around the reference, you get
+# the list back properly.
+