我擅长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
答案 0 :(得分:6)
您的第一个if
缺少fi
。
答案 1 :(得分:3)
您在文件末尾添加fi
时遗漏了它。
还要摆脱EOF
。您案例中的EOF
被视为命令。
有时使用不同的shell运行脚本会为您提供有关错误的线索。
当我们使用以下程序运行您的程序时
sh
它说Syntax error: end of
file unexpected (expecting "fi")
csh
它说if: Expression
Syntax.