Help with csh script

Ok I asked something similar earlier with no response, so maybe I didn't word it correctly. I'm new at this, so thank you for your help.

Here's what I have right now.
----------------------------

> cat MySourceFile
#!/bin/csh
 
echo "Please Enter Value For My_Env_Var:"
set answer = $<
 
setenv My_Env_Var $answer
 
echo "My_Env_Var in source file is set to $My_Env_Var"
 
> cat MyInputFile.txt
Hello_World
 
> cat MyScript.csh
#!/bin/csh
 
source MySourceFile < MyInputFile.txt
 
echo "My_Env_Var in script file is set to $My_Env_Var"
 
> MyScript.csh
Please Enter Value For My_Env_Var:
 

----------------------------

When I run MyScript.csh it's waiting for input from the keyboard, even though I tried to redirect the contents of MyInputFile.txt to use as input.

How do I use the contents of MyInputFile.txt as the input for the source of MySourceFile?

If this can't be done using a .txt file, is there another way it can be done?

Thank you for any help you can provide

Please put source code inside

 tags.


> cat MySourceFile
#!/bin/csh
 

[/quote]

[indent]
Top Ten Reasons not to use the C shell
Csh problems
Csh Programming Considered Harmful

Use the standard Unix shell, not csh.

#!/bin/sh
read My_Env_Var
echo "My_Env_Var in source file is set to $My_Env_Var"

Call it with:

MyScript.sh < MyInputFile.txt