tcsh returns a wrong value as $status

Solution Verified - Updated -

Issue

  • The $status value of tcsh must be exit status of the last command.
  • However, there is the case that the $status value of tcsh is not exit status of the last command.
  • Step to reproduce:
    Case 1)
      -----
      # cat no-exist | wc -l
      cat: no-exist: No such file or directory
      0
      # echo $status
      1  <= Expected status is 0.
      -----
      1st: cat no-exist => exit status 1
      2nd: wc -l => exit status 0
      $status must be 0
    
    Case 2)
      -----
      # echo `cat no-exist | wc -l`
      cat: no-exist: No such file or directory
      0
      # echo $status
      1  <= Expected status is 0.
      -----
    
      1st: cat no-exist => exit status 1
      2nd: wc -l => exit status 0
      3rd: echo => exit status 0
      $status must be 0
    

Environment

  • Red Hat Enterprise Linux 5.5
  • tcsh-6.14-17.el5

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