Skip to Main Content

Infrastructure Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

{bash scripting} Multiline initialisation of string variable

Artem KhisamievJun 8 2012 — edited Jun 8 2012
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.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 6 2012
Added on Jun 8 2012
1 comment
143 views