please help: how to redirect input into a variable

I'm trying to write a simple script program (C shell). I have a problem redirecting input into a variable. Say I have a variable called J, and there is file called result which contains just some number, say 5. Which command should I use to assign J value 5 from the file result. I tried the following commands:

set J = $<result
set J = $<cat result
set J < result

and neither of these works. Please advise if you know the right commands, thanks:)

You could use the following:

set J=`cat in.txt`

echo $J

I tried this with only one line in the file "in.txt", so I do not know how this works when you have multiple lines. BTW the ` is not a single quote, but something that only looks like it. On my key board I find this character next to my "p" key.

Thanks a bunch, worked like a charm!
:slight_smile: Art