csh/tcsh by default exits with error on undefined variables. I want to suppress that behavior for a piece of code just like bash does with set +u
. Is there a way to do that?
No, there is no setting for this.
The best you can do is check if the variable exists with $?varname
:
if ( $?undefined ) then
echo "$undefined"
endif
Or use if ( ! $?undefined )
to inverse the check.