How to nest multi lines string in csh?

57 Views Asked by At

I am trying to set variables with string, and construct a more complex string by nesting them. For readibility purpose, I have these strings on multiple lines using \ characters. When I try to do this without the \ it seems to work, but I can't have something working with it.

Example of not working code :

set String_A = "Make \
Something \
End"

set String_B = "${String_A} \
And add \
Something else"

set String_C = "${String_B} Finally something good"

Example of working but unclear code :

set String_A = "Pretty long and unreadable"

set String_B = "${String_A} And add Something else"

set String_C = "${String_B} Finally something"

Could you find a solution where I meet my two requirements ? (Readability on multi lines, and nested strings using variables ?)

Have a good day, Julien

1

There are 1 best solutions below

5
X3R0 On

use single quotes and no space before the slash

set String_A = 'Make\
Something\
End'

set String_B = '${String_A}\
And add\
Something else'

set String_C = '${String_B} Finally something good'

echo $help:q