Skip to navigation

tcsh returns a wrong value as $status

Updated 2011-07-22T01:03:46+00:00

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 content preview. For full access to the Red Hat Knowledgebase, please log in.

Not a subscriber? Learn more about the benefits of Red Hat Subscriptions.