3

I want to assign to variable to a multi-line string that contains a variable and then echo it. I attempted using here-doc as shown below. What is the best way to achieve this in csh?

set my_name="JOHN"
set my_var=<<EOF
"name":"${my_name}"
EOF

echo ${my_name}
echo ${my_var}
-1

Have you tried the following ?

set my_var = '\
"name":"${my_name}" \
'

then:

echo $my_var:q

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.