csh
is an utterly horrible shell. (Making that statement up front to avoid the inevitable comments of "don't use csh", or perhaps I should just state that for the sake of any readers: please, if you value your sanity, do not use csh
.) I have a rather large collection of csh
scripts that I'm trying to make useful, and I just discovered that exit
does not exit the script when called from a sourced file. In other words:
#!/bin/csh
source [file with content "exit"]
echo No reasonable script should print this
Produces output.
Is there any way to modify that behavior? As far as I can tell, the original authors of the scripts I am modifying intended the main script to terminate, and that certainly would be desirable behavior, and simply invoking the example above via sh
produces that result, but what gives? Is there any reasonable purpose for this behavior? (That's just me ranting, the real question is: is there an option to csh to change the behavior?)