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, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content