Substitution Occurs in a True / False Statement in C

Solution Verified - Updated -

Issue

  • Substitution Occurs in a True / False Statement in C
  • (csh) In one line “if” statement, substition still occurs in command even if expr is false.
  • if (expr) command:

    # csh
    # if 0 echo $SHLIB_PATH
    SHLIB_PATH: Undefined variable.
    # exit
    
  • SHLIB_PATH: Undefined variable.

  • If the express is false no operations should be done on the command, but in the example substitution is still erroneously attempted resulting in an error message.
  • I should get the same results from a single line “if” statement as from a equivalent multiline “if” statement.

Environment

  • tcsh-6.13-10.el4
  • Red Hat Enterprise Linux 4.8

  • Red Hat Enterprise Linux 5.5

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.