next up previous contents index
Next: Known Bugs Up: Shell Scripts Previous: C-Shell meta characters

Error Messages

  Here we list a number of common errors  that occur in C-shell scripts.

No match:
You probably forgot to quote a so-called shell meta character (one of * ? [ ] ( ) $ ), since the shell tried to use them as file wildcard expansion. A common example is
	ants=*

which should have read

	ants='*'  or ants=\*

Undefined variable:
A (shell or environment) variable was never set. If you want, you can use a test to see if the variable really exists, and take appropriate actions:

if ($?var == 0) then
    echo "Variable 'var' does not exist"
else
    echo "Variable 'var' has the value $var"
endif

Expression Syntax:
Well, this could almost be anything. You probably need to run the script in verbose (-v) or echo (-x) mode to see where and how the syntax error came about. In checker mode the debug=  keyword to the project  command can be used to increase the output.

Badly formed number:
Numbers in the C-shell must be integers. So you cannot do ``@ a=1.1'' or ``if ( $lst > 10.5 ) echo $lst''. Some simple floating point math can be done with the UNIX program bc   or the Miriad program calc  .

        echo "1.2*sqrt(3)" | bc -l
        calc "1.2*sqrt(3)"

Command not found:
You either misspelled the command, or you have  the search path   set wrong. Check the PATH environment or path shell variables (they are equivalent, a change in one will change the other).


next up previous contents index
Next: Known Bugs Up: Shell Scripts Previous: C-Shell meta characters
Peter Teuben
9/29/2000