Behaviour of csh single quote changed between RHEL4 and RHEL5

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux 5
  • tcsh-6.14-17.el5.x86_64

Issue

  • Behaviour on Red Hat Enterprise Linux 4 using csh (RPM: tcsh-6.13-10.el4)
# echo '\this is a test' 
        \this is a test
  • Behaviour on RHEL 5 using csh (RPM: tcsh-6.14-17.el5.x86_64)
    #echo '\this is a test'
              his is a test
  • The string in single quotes should not interpret backslash and the csh in RHEL5 behaviour seems like a bug.

Resolution

  • Set "echo_style=bsd" fixes the problem in RHEL-5
    ~]$ echo '\test'
    est
    ~]$ set echo_style=bsd
    ~]$ echo '\test'
    \test
  • The default echo_style setting is being auto-detected at compile time and depends on the machine architecture (macros defined in standard headers) which have been changed between RHEL-4 and RHEL-5 releases. The default setting can be easily overridden by setting the echo_style in one of the startup sourced scripts.

Root Cause

  • The difference is in the default setting of the echo_style variable  which controls the way the echo treats the escape sequences (see # man  csh for details)

  • On RHEL-4

    ~]$ echo $echo_style
    bsd
  • On RHEL-5
    ~]$ echo $echo_style

    both

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments