1) Declaration
I have pairs of, for example, directories. The pairs contain spaces (and/or other inconveniences like extra periods or special chars. Anything ext4 easily supports let say.)
'/foo/dolor sit/amet.elit' '/bar/accumsan/luctus massa.nec'
'/baz/sagittis. Fusce/vitae.dolor' '/bam/Nunc aliquetjusto.metus'
I want to write a bash script where these pairs are hard-coded/constants.
I would highly prefer declaring the strings within a delimiter or such that does not need the arbitrary string to be preprocessed (eg I don't want to add escapes on all literal whitespaces if possible)
2) Iteration
With declared pairs of strings, I wish to enter a loop where both the strings are available in one iteration as separate variables, e.g. $LEFT
and $RIGHT
.
Likely uses being simple file operations like copy, move, link, diff.
Notes:
- The "height" of the array should allow many many pairs.
- If the declaration and iteration can support wider-than-2 2D arrays please note how to extend to desired with.
- If bash has an "array" specific datatype, its use is not mandatory to the question/answer. Any iterable 2-dimensional declaration and iteration is sufficient.