zoukankan      html  css  js  c++  java
  • exec /bin/tcsh produces a “if: Expression Syntax.” error

    https://unix.stackexchange.com/questions/538329/exec-bin-tcsh-produces-a-if-expression-syntax-error

    We have two servers: test box with Oracle Linux 7.6 and production box with Oracle Linux 7.7.

    Running the exec /bin/tcsh command produces two different results.

    On the test server:

    # exec /bin/tcsh
    #
    

    No errors; however, on the production server:

    # exec /bin/tcsh
    if: Expression Syntax.
    #
    

    We thought that there was an issue with the tcsh package on the production box and uninstalled/re-installed it but doing this did not resolve the issue. Any thoughts/suggestions as to what else we can try to resolve this issue?

    One of the comments suggested adding -V to the command. Here are the last few lines of the output:

    if ( $?QT_PLUGIN_PATH ) then
    if ( "${QT_PLUGIN_PATH}" !~ *${libdir}/kde4/plugins* ) then
    else
    
    end
    
    
    if [ ! -d ${HOME}/.local/share -a -w ${HOME} ] then
    if: Expression Syntax.
    

    There is a test server in which the exec command does not abend. Here's the -V output for the same line above:

    if ( ! -d ${HOME}/.local/share ) then
    

    The only different is the -a -w ${HOME}

    解决方案1:

    Such an error message might be caused by a syntax error in the login scripts executed by the tcsh shell:

    • system-wide /etc/csh.cshrc
    • system-wide /etc/csh.login
    • user-specific ~/.cshrc
    • user-specific ~/.login

    In Bourne/POSIX-style shells, the if statement is typically if [ condition ]; then ... else ... fi, but csh and tcsh express it as if (condition) then ... else ... endif. If you're used to Bourne/POSIX-style scripting, it is easy to type fi instead of endif when scripting for tcsh.

    解决方案2:

    1
     

    The answer is that there is a bug in the kde-settings package. There is bourne-shell code in kde.csh.

    We decided to perform the work-around and edited the /etc/profile.d/kde.csh file in the following manner:

    original line: if [ ! -d ${HOME}/.local/share -a -w ${HOME} ]

    edited line: if ( ! -d ${HOME}/.local/share && -w ${HOME} )

    Version-Release number of selected component (if applicable): kde-settings-19-23.9.el7.noarch

    This is the version that is installed on the server. There is an update available, which was not installed, kde-settings-19-23.10. Here's the link to the bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1738491.

  • 相关阅读:
    SqlBulkCopy实现大容量数据快速插入数据库中
    防查询语句注入漏洞攻击
    wpf中数据绑定(Datacontext)的应用
    WPF中StackPanel的使用方法
    可空类型的使用《二》
    关于可空数据类型的介绍
    C# 之泛型详解
    C# 之String以及浅拷贝与深拷贝
    C# 小软件部分(二)
    MVC 之HTML辅助方法
  • 原文地址:https://www.cnblogs.com/weikui/p/13995764.html
Copyright © 2011-2022 走看看