Fail using command substitution
cat >a.txt <<A
a
b
c
A
set data="`cat a.txt`"
cat -n <<A
$data
A
# The output is
# 1 a b c
setenv data "`cat a.txt`"
cat -n <<A
$data
A
I read the mac document, it seemed csh just turn it into a word list during command substitution. I have tried using unset csubstnonl. It doesn't work.
My questions is, is there another way in csh that I can read the file and save the content to a variable preserving newline ?
My csh version is :
tcsh 6.24.10 (Astron) 2023-04-14 (aarch64-apple-darwin) options wide,nls,dl,al,kan,sm,rh,color,filec
Fail using command substitution
I read the mac document, it seemed csh just turn it into a word list during command substitution. I have tried using
unset csubstnonl. It doesn't work.My questions is, is there another way in csh that I can read the file and save the content to a variable preserving newline ?
My csh version is :
tcsh 6.24.10 (Astron) 2023-04-14 (aarch64-apple-darwin) options wide,nls,dl,al,kan,sm,rh,color,filec