• 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.

  • 相关阅读:
    MySql查询当前数据的上一条和下一条的记录
    FastAdmin的基本使用
    ThinkPHP5——安装验证码和使用
    ThinkPHP的模型关联(多对多关联)
    ThinkPHP5——模型关联(一对一关联)
    python之路----递归函数(二分查找法)
    python之路----整理函数知识点(字符编码,文件处理)
    python基础:重要篇 -----基本数据类型和用法
    python基础:网络基础和python基础(变量和程序交互)
    计算机基础系列一:操作系统
  • 原文地址:https://www.cnblogs.com/weikui/p/13995764.html
Copyright © 2020-2023  润新知