第 18 行语法错误:`

第 18 行语法错误:`

这是我的脚本

#!/bin/bash
stty intr ^C erase ^H kill ^U
p_id=`ps -ef|grep iucmh|grep iuc|grep MSC015|grep START|awk -F" " '{print $2}'`

vLogin=`echo "iucmh/iucmh123@4s_MH"`

if [ -z "$p_id" ]; then
     sqlplus -s ${vLogin} <<EOF
     set pagesize 0 
     feedback off 
     verify off 
     heading off 
     echo off;
     UPDATE  IUC_CON_PARAMETERS
     SET F_PARAM_VALUE=0
     WHERE F_PARAM_NAME LIKE 'MSC015_PROCESS_ID'
     EXIT;
EOF

    echo "Working"
#     fi
else
     echo "Process is already Running"
     fi

运行此脚本我收到以下错误:

Syntax error at line 18 : `<<' is not matched.

答案1

代码没问题,bash不包含您提到的错误消息。

尝试:

#!/bin/bash

if [ bla ]; then
     cat <<EOF
     set pagesize 0 
     feedback off 
     verify off 
     heading off 
     echo off;
     UPDATE  IUC_CON_PARAMETERS
     SET F_PARAM_VALUE=0
     WHERE F_PARAM_NAME LIKE 'MSC015_PROCESS_ID'
     EXIT;
EOF

    echo "Working"
#     fi
else
     echo "Process is already Running"
     fi

并验证。所以我猜你的消息来自命令sqlplus

相关内容