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.

  • 相关阅读:
    Debian Linux 查看用户命令
    WPF 样式(Style)(2)
    SQLServer2012下更改数据库名字
    WPF 触发器Triggers
    随记
    网页打印总结(1)
    安装node.js,CoffeeScript,Express.js,mysql,jade
    javascript——this
    win8下IIS8.0下uploadifyv3.1上传文件超过30M,报HTTP Error(404)
    Linux软件安装常用方法(转载)
  • 原文地址:https://www.cnblogs.com/weikui/p/13995764.html
Copyright © 2011-2022 走看看