免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: 116264755
打印 上一主题 下一主题

[文本处理] syntax error: unexpected end of file [复制链接]

论坛徽章:
0
11 [报告]
发表于 2013-08-28 10:50 |只看该作者
回复 10# 关阴月飞


    加了空格了。。

但是。。
发生这个错误。。
kenlf0508@ubuntu:~/Downloads/fakerat$ ./run

***************************************************
ERROR in starting up fakesat_menu
menu_defaults file:   does NOT exist
***************************************************

kenlf0508@ubuntu:~/Downloads/fakerat$

我明明是有menu_defaults的。。。但是却说不存在??

全部代码如下:
#! /bin/bash

#*****************************************
#
# csh script used to run fakesat_menu
#
# D. W. Murphy        Last changed: 25-May-1995
#
#*****************************************

#
# In order for fakesat to run correctly a
# few environmental variables need to be set.
# If you need to set an environmental variable
# un-comment out the appropriate # setenv line
# by removing the # and then set the variable
# as you wish.


#*****************************************
# PGPLOT_FONT
#*****************************************

# set PGPLOT_FONT to the pathname of grfont.dat,
# if required.

export PGPLOT_FONT=/usr/lib/pgplot/grfont.dat

# notes:

# For pre 5.0 versions of PGPLOT there is no
# to set  PGPLOT_FONT if grfont.dat is in
# /usr/local/vlb/pgplot on SUN workstations

# For pre 5.0 versions of PGPLOT there is no
# to set  PGPLOT_FONT if grfont.dat is in
# /usr/src/pgplot on HP workstations


#*****************************************
# PGPLOT_DIR
#*****************************************

# In 5.0 or higher versions of PGPLOT:

# The environmental variable PGPLOT_DIR is used to show the
# location of:
# (i) the pgxwin_server program, if this program is not
# in a directory in your path.
# and
# (ii) the PGPLOT library, if it is not in the library path
# specified by the environmental variable LD_LIBRARY_PATH.

# set PGPLOT_DIR, if required:

# export PGPLOT_DIR=<directory name>

#*****************************************
# PGPLOT_XW_CLICKLEFT
#*****************************************

# In pre 5.0 versions of PGPLOT:

# If PGPLOT_XW_CLICKLEFT is set to 1.
# X windows created by fakesat will
# not be destroyed until there is a
# click of the left hand mouse button
# in them:

# set PGPLOT_XW_CLICKLEFT here, if required:

export PGPLOT_XW_CLICKLEFT=1

#*****************************************
# PGPLOT_XW_WIDTH
#*****************************************

# In pre 5.0 versions of PGPLOT:

# PGPLOT_XW_WIDTH set the size of an X window
# created by fakesat and fakesat_menu relative
# to a default size:

# set PGPLOT_XW_WIDTH here, if required:

export PGPLOT_XW_WIDTH=0.8

#*****************************************
# End of Environmental Variables
#*****************************************



#*****************************************
# Running fakesat_menu via an XWindow
#*****************************************

#  set menu_defaults = $1

# note: since -f is a csh file inquiry operator need
# to turn off this feature by creating the variable a

  set a=a$1

#  echo 'a is: ' $a

if [[ $a == "a-h" ]]; then
echo  ' '
echo 'possible run options are:'
echo ' '
echo 'run    : run fakesat_menu with simple menu'
echo 'run -h : help option'
echo 'run -s : run fakesat_menu with simple menu'
echo 'run -c : run fakesat_menu with complex menu'
echo 'run -f : re-initialize everything by running fakesat_init -f'
echo '         followed by run'
echo '  '
exit
fi

  set menu = s
  set menu_defaults = menu_defaults

if [[ ${#argv} == 1 ]]; then
  set menu_defaults = $1
fi

if [[ $a == "a-f" ]]; then
echo 'run -f option: '
fakesat_init -f
set menu = s
set menu_defaults = menu_defaults
fi

if [[ $a == "a-s" ]]; then
echo 'run -s option: using simple menu'
set menu = s
set menu_defaults = menu_defaults
fi

if [[ $a == "a-c" ]]; then
echo 'run -c option: using complex menu'
set menu = c
set menu_defaults = menu_defaults
fi

if [[ ${#argv} == 2 ]]; then
  set menu_defaults = $2
fi

if [[ ! -e $menu_defaults ]]; then
echo ' '
echo '***************************************************'
echo ' ERROR in starting up fakesat_menu'
echo ' menu_defaults file: ' $menu_defaults ' does NOT exist'
echo '***************************************************'
echo ' '
exit
fi

fakesat_menu <<EOD
$menu_defaults
$menu
EOD

exit

论坛徽章:
0
12 [报告]
发表于 2013-08-28 10:52 |只看该作者
回复 9# Shell_HAT


     加了空格了。。

但是。。
发生这个错误。。
kenlf0508@ubuntu:~/Downloads/fakerat$ ./run

***************************************************
ERROR in starting up fakesat_menu
menu_defaults file:   does NOT exist
***************************************************

kenlf0508@ubuntu:~/Downloads/fakerat$

我明明是有menu_defaults的。。。但是却说不存在??

全部代码如下:
#! /bin/bash

#*****************************************
#
# csh script used to run fakesat_menu
#
# D. W. Murphy        Last changed: 25-May-1995
#
#*****************************************

#
# In order for fakesat to run correctly a
# few environmental variables need to be set.
# If you need to set an environmental variable
# un-comment out the appropriate # setenv line
# by removing the # and then set the variable
# as you wish.


#*****************************************
# PGPLOT_FONT
#*****************************************

# set PGPLOT_FONT to the pathname of grfont.dat,
# if required.

export PGPLOT_FONT=/usr/lib/pgplot/grfont.dat

# notes:

# For pre 5.0 versions of PGPLOT there is no
# to set  PGPLOT_FONT if grfont.dat is in
# /usr/local/vlb/pgplot on SUN workstations

# For pre 5.0 versions of PGPLOT there is no
# to set  PGPLOT_FONT if grfont.dat is in
# /usr/src/pgplot on HP workstations


#*****************************************
# PGPLOT_DIR
#*****************************************

# In 5.0 or higher versions of PGPLOT:

# The environmental variable PGPLOT_DIR is used to show the
# location of:
# (i) the pgxwin_server program, if this program is not
# in a directory in your path.
# and
# (ii) the PGPLOT library, if it is not in the library path
# specified by the environmental variable LD_LIBRARY_PATH.

# set PGPLOT_DIR, if required:

# export PGPLOT_DIR=<directory name>

#*****************************************
# PGPLOT_XW_CLICKLEFT
#*****************************************

# In pre 5.0 versions of PGPLOT:

# If PGPLOT_XW_CLICKLEFT is set to 1.
# X windows created by fakesat will
# not be destroyed until there is a
# click of the left hand mouse button
# in them:

# set PGPLOT_XW_CLICKLEFT here, if required:

export PGPLOT_XW_CLICKLEFT=1

#*****************************************
# PGPLOT_XW_WIDTH
#*****************************************

# In pre 5.0 versions of PGPLOT:

# PGPLOT_XW_WIDTH set the size of an X window
# created by fakesat and fakesat_menu relative
# to a default size:

# set PGPLOT_XW_WIDTH here, if required:

export PGPLOT_XW_WIDTH=0.8

#*****************************************
# End of Environmental Variables
#*****************************************



#*****************************************
# Running fakesat_menu via an XWindow
#*****************************************

#  set menu_defaults = $1

# note: since -f is a csh file inquiry operator need
# to turn off this feature by creating the variable a

  set a=a$1

#  echo 'a is: ' $a

if [[ $a == "a-h" ]]; then
echo  ' '
echo 'possible run options are:'
echo ' '
echo 'run    : run fakesat_menu with simple menu'
echo 'run -h : help option'
echo 'run -s : run fakesat_menu with simple menu'
echo 'run -c : run fakesat_menu with complex menu'
echo 'run -f : re-initialize everything by running fakesat_init -f'
echo '         followed by run'
echo '  '
exit
fi

  set menu = s
  set menu_defaults = menu_defaults

if [[ ${#argv} == 1 ]]; then
  set menu_defaults = $1
fi

if [[ $a == "a-f" ]]; then
echo 'run -f option: '
fakesat_init -f
set menu = s
set menu_defaults = menu_defaults
fi

if [[ $a == "a-s" ]]; then
echo 'run -s option: using simple menu'
set menu = s
set menu_defaults = menu_defaults
fi

if [[ $a == "a-c" ]]; then
echo 'run -c option: using complex menu'
set menu = c
set menu_defaults = menu_defaults
fi

if [[ ${#argv} == 2 ]]; then
  set menu_defaults = $2
fi

if [[ ! -e $menu_defaults ]]; then
echo ' '
echo '***************************************************'
echo ' ERROR in starting up fakesat_menu'
echo ' menu_defaults file: ' $menu_defaults ' does NOT exist'
echo '***************************************************'
echo ' '
exit
fi

fakesat_menu <<EOD
$menu_defaults
$menu
EOD

exit

论坛徽章:
33
ChinaUnix元老
日期:2015-02-02 08:55:39CU十四周年纪念徽章
日期:2019-08-20 08:30:3720周年集字徽章-周	
日期:2020-10-28 14:13:3020周年集字徽章-20	
日期:2020-10-28 14:04:3019周年集字徽章-CU
日期:2019-09-08 23:26:2519周年集字徽章-19
日期:2019-08-27 13:31:262016科比退役纪念章
日期:2022-04-24 14:33:24
13 [报告]
发表于 2013-08-28 11:00 |只看该作者
回复 12# 116264755
  1. set menu_defaults = $1
复制代码
csh里面定义变量的方法在bash里面不好使,bash里面是这样的:
  1. menu_defaults=$1
复制代码

论坛徽章:
1
天蝎座
日期:2013-08-22 15:14:44
14 [报告]
发表于 2013-08-28 11:03 |只看该作者
回复 12# 116264755


    Bash里面的直接menu_defaults=$1,注意等号两侧不能有空格

论坛徽章:
0
15
发表于 2013-08-28 11:11
回复 13# Shell_HAT


    受教育了!!!我试试!!!非常感谢!!大神!!膜拜!

论坛徽章:
0
16 [报告]
发表于 2013-08-28 11:11 |只看该作者
回复 14# guogang225


    受教育了!!!我试试!!!非常感谢!!大神!

论坛徽章:
0
17 [报告]
发表于 2013-08-28 11:13 |只看该作者
回复 13# Shell_HAT


    那么。。。==两侧也是一样么??不能加空格??

论坛徽章:
0
18 [报告]
发表于 2013-08-28 11:19 |只看该作者
回复 16# 116264755


    那么。。。==两侧也是一样么??不能加空格??

论坛徽章:
39
辰龙
日期:2013-08-21 15:45:192015亚冠之广州富力
日期:2015-05-12 16:34:52亥猪
日期:2015-03-03 17:22:00申猴
日期:2015-03-03 17:21:37未羊
日期:2014-10-10 13:45:41戌狗
日期:2014-06-17 09:53:29巨蟹座
日期:2014-06-12 23:17:17双鱼座
日期:2014-06-10 12:42:44寅虎
日期:2014-06-09 12:52:172015亚冠之卡尔希纳萨夫
日期:2015-05-24 15:24:35黄金圣斗士
日期:2015-12-02 17:25:0815-16赛季CBA联赛之吉林
日期:2017-06-24 16:43:52
19 [报告]
发表于 2013-08-28 11:21 |只看该作者
本帖最后由 关阴月飞 于 2013-08-28 11:33 编辑

回复 17# 116264755


    这个,其实你自己测试一下就知道了,多问无益......

论坛徽章:
0
20 [报告]
发表于 2013-08-28 11:29 |只看该作者
回复 16# 116264755


    那么。。。==两侧也是一样么??不能加空格??
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP