我收到了这个脚本的unexpected end of file on line 27
,我没有写,但是出现在我的/ etc / profile文件夹中,显然是为我的BASH shell控制台设置环境变量。所以每当我启动一个新的控制台时,我都会收到这个错误,这很烦人。
任何人都可以帮我解决问题吗?有两个脚本......都是c-shell脚本(* .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
#! /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编程的新手,我觉得在脚本中的某个地方有一些模糊的错误(对我而言)。
答案 0 :(得分:0)
这些脚本以#!/bin/csh
开头,而不是#!/bin/csh -f
(这是更好的格式),因此它们将始终运行您自己的 shell启动文件(例如.cshrc
或每次调用它们时,您的主目录中都会.tcshrc
。
有两个不相关的脚本有错误,它们之间的共同点可能就是你自己的点文件。首先将-f
添加到每个脚本的第一行,看看是否可以解决问题;然后在你自己的文件中查找语法错误。