使用 EOF 传递 weblogic 密码

passing weblogic password using EOF

这是我的代码

echo "Shutting Down UAT Concurent Manager"

con=`ps -ef | grep appluat |wc -l`

if [ $con -ge 1 ]
then
     echo "Concurrent is up and running, shutting it down......"
     su - appluat -c "/home/UAT2/apps2/fs1/inst/apps/UAT_erp/admin/scripts/adstpall.sh apps/xxxx "
     <<EOF weblogic xxxxx
      EOF"

else
     echo "Concurrent is already down"
fi

为什么会抛出这个错误?

./shutdown_uat_apps.sh: line 14: warning: here-document at line 9 delimited by end-of-file (wanted `EOF')
./shutdown_uat_apps.sh: line 15: syntax error: unexpected end of file

问题是您正在启动一个 here-document,但从未关闭它。要关闭它,EOF 需要位于行的开头:

 su - appluat -c "/home/UAT2/apps2/fs1/inst/apps/UAT_erp/admin/scripts/adstpall.sh apps/xxxx"
 <<EOF weblogic xxxxx
  EOF"

你对上面代码的意图是什么?

要修复语法,您需要按如下方式进行更改,但仍然没有意义:

 su - appluat -c "/home/UAT2/apps2/fs1/inst/apps/UAT_erp/admin/scripts/adstpall.sh apps/xxxx "
 <<EOF weblogic xxxxx
EOF

另见

Here-documents

应该在初始报价之内"...":

  "/home/UAT2/apps2/fs1/inst/apps/UAT_erp/admin/scripts/adstpall.sh 
  apps/xxxxxpassxxx <<EOF
  xxxxpasswordxxxx
  EOF"