DISQUS

Tech-Recipes: csh/C shell scripts: if statement syntax | csh shell scripting | Tech-Recipes

  • Dan · 1 year ago
    test for the existence of a variable using
    if ($?LD_LIBRARY_PATH == 0) then
    setenv LD_LIBRARY_PATH /usr/lib;
    endif
  • Dan · 9 months ago
    A variation of the above would be:

    if ( ! ${?LD_LIBRARY_PATH} ) then
    setenv LD_LIBRARY_PATH /usr/lib
    endif

    Use the {} around variables as a habit since the variable names can often interfere with shell syntax.

    The semicolon at the end is ignored.
  • Dan · 9 months ago
    Without concrete examples of how the syntax is actually used, this is almost useless information.
  • Paul · 3 days ago
    Almost? More like completely...