一个shell的问题

来源:互联网 发布:nginx 访问路径出错 编辑:程序博客网 时间:2024/04/30 03:52
今天写shell的时候,碰到一个问题,如果写如下的脚本:
  1. update_lookup_cde()
  2. {
  3.     _cde_value=$1
  4.     
  5.     sqlplus -s scott/tigger@orcl<<END       
  6.         commit;
  7.         exit;
  8.         END
  9.     return 0    
  10. }
这样执行的时候,语法检查通不过,系统会提示文件没有结束
  1. syntax error: unexpected end of file
经过搜索才知道,END前面不能有空格等,

应该写成这样

  1. update_lookup_cde()
  2. {
  3.     _cde_value=$1
  4.     
  5.     sqlplus -s scott/tigger@orcl<<END
  6.         commit;
  7.         exit;
  8. END
  9.     return 0    
  10. }

这样就可以了,记下来,呵呵
原创粉丝点击