.profile:第31行:语法错误:意外的文件结束

时间:2010-10-06 05:11:21

标签: bash .profile

我擅长bash编程。错误在哪里?这是我的.profile文件:

# WARNING: For help understanding this file, and before you try
# to change any of it, type "man .profile" and read carefully.
#

#
# Set command search rules
#
if [ -x /bin/showpath ] ; then  
    export PATH; PATH=`/bin/showpath $HOME/bin /u/cs350/sys161/bin /software/gnu/bin standard`
    export PATH; PATH=`/bin/showpath usedby=user standard $HOME/bin`
#
# Find out what kind of terminal we are using
#
    eval `setterm  sytek:kd404  default:vc404`
#
# Set terminal-type dependent options (e.g. sysline or prompt string)
#
    #HOMEHOST="<hostname>"
    #HOMEUSER="<userid>"
    #export HOMEHOST HOMEUSER
    PS1="$ "
#
# Now do the usual signing on things
#
    export MAIL; MAIL=${MAIL-"/usr/spool/mail/$USER"}

if [ -r /software/.admin/bins/bin/read_system_news ] ; then /software/.admin/bins/bin/read_system_news ; fi

EOF

2 个答案:

答案 0 :(得分:6)

您的第一个if缺少fi

答案 1 :(得分:3)

您在文件末尾添加fi时遗漏了它。

还要摆脱EOF。您案例中的EOF被视为命令。

有时使用不同的shell运行脚本会为您提供有关错误的线索。

当我们使用以下程序运行您的程序时

  • sh它说Syntax error: end of file unexpected (expecting "fi")
  • csh它说if: Expression Syntax.