{bash scripting} Multiline initialisation of string variable

Hello,

The task is quite simple. I need to initialise string variable and assign to it a very long value. For the reason of readability I want to devide this long value into equal parts and place each part at a separate line.

For instance, I have -

MY_STRING_VAR="QWERTUQWERTYQWERTYQWERTY"

and I want to make it multiline but with equal meaning -

MY_STRING_VAR="QWERTU
               QWERTU
               QWERTU
               QWERTU"

i.e. eventually between "QWERTU" there shouldn't be any space or enything else if we echo it, and the string have to be equal to previous initialisation.

Thank you,
Artem.

MY_STRING_VAR="QWERTU\
QWERTU\
QWERTU\
QWERTU"
1 Like