我得到了一个unexpected end of file on line 27
这个脚本,它不是我写的,但出现在我的 /etc/profile 文件夹中,显然是为了为我的 BASH shell 控制台设置环境变量而执行的。所以每次我启动一个新的控制台时,我都会收到这个错误,这很烦人。
谁能帮我找出问题所在?有 2 个脚本...都是 c-shell 脚本 (*.csh)
这是第一个给我的第一个错误(libglib2.csh):
#! /bin/csh
#
# Description: This script sets the environment variables G_FILENAME_ENCODING
# and G_BROKEN_FILENAMES for the glib-2.0 library.
#
# G_FILENAME_ENCODING
# This environment variable can be set to a comma-separated list of
# character set names. GLib assumes that filenames are encoded in the
# first character set from that list rather than in UTF-8. The special
# token "@locale" can be used to specify the character set for the
# current locale.
#
# G_BROKEN_FILENAMES
# If this environment variable is set, GLib assumes that filenames are
# in the locale encoding rather than in UTF-8.
# If the LANG you have set contains any form of "UTF", we will guess you are
# using a UTF-8 locale. Hopefully we're correct.
echo $LANG | grep -iq UTF
if ($status==0) then
setenv G_FILENAME_ENCODING "@locale"
endif
# It doesn't hurt to export this since G_FILENAME_ENCODING takes priority
# over G_BROKEN_FILENAMES:
setenv G_BROKEN_FILENAMES 1
这是第二个,也给出了一个错误(qt4.csh):
#! /bin/csh
# Environment path variables for the Qt package:
if (! $?QT4DIR ) then
# It's best to use the generic directory to avoid
# compiling in a version-containing path:
if ( -d /usr/lib/qt ) then
set path "QT4DIR /usr/lib/qt"
else
# Find the newest Qt directory and set $QT4DIR to that:
foreach qtd "/usr/lib/qt-*"
if (-d $qtd ) then
setenv QT4DIR $qtd
endif
end
endif
endif
set path = $path "$QT4DIR /bin"
if ( $?CPLUS_INCLUDE_PATH ) then
export CPLUS_INCLUDE_PATH $QT4DIR/include:$CPLUS_INCLUDE_PATH
else
export CPLUS_INCLUDE_PATH $QT4DIR/include
endif
exit
这些脚本似乎有与之关联的相应 Bourne shell 脚本,但我只从控制台收到错误,告诉我 .csh 文件有错误(文件意外结束)。当我启动控制台终端窗口时,没有任何关于 .sh 脚本的报告。
我是 Unix 脚本和 shell 编程的新手,我感觉在脚本前面的某个地方存在一些小的(对我而言)格式错误。