当前位置:网站首页>Shell script "< < EOF" my purpose and problems
Shell script "< < EOF" my purpose and problems
2022-07-24 11:27:00 【suanday_ sunny】
I understand it :<< EOF … EOF It is mainly used to send batch internal execution statements to external commands , such as mysql, such as Oracle
mysql:
#!/bin/sh
mysql -uroot -p123456 <<EOF use test; select * from testaa while a=10000; exit EOF
Oracle
#!/bin/bash
#Filename:do.sh
su - oracle -c " export ORACLE_SID=orcl sqlplus /nolog << EOF connect / as sysdba startup; exit; EOF"
sleep 5
su - oracle -c
lsnrctl start
For example, I did this to mysql Sent an execution action , save xxx
$MYSQL db-monitor -u root << EOF delete from process; update application set run_status=0, ins_count=0; select concat(application_name,':',server_port) comp from tbl_application order by id; EOF
however , Inside this Whether the output of the execution statement can be in shell Read in , I don't know !!!...
A note :
At the end of the EOF Write on a single line ,
And there should be no blank space in front, It seems that there should be no blank space behind . Accustomed to indenting left and right , hold<< EOFWritten in a function or loop , Attention should be paid to the .

Whether to combine commands and compare them
while [" Primary cycle "]; do
while ["2 Stage cycle "]; do
# Separately SQL
# sql1="INSERT INTO process ( pid, application_name,server_port,listen_port, xmx) VALUES "
# sql2="(${pid},'${app_name}',${server_port}, '${net_port:1}', '${Xmx}')"
#
# $MYSQL -uroot doorbell-monitor -e "${sql1} ${sql2}"
#
# $MYSQL -uroot db-monitor -e "update tbl_application set run_status=1, ins_count=ins_count+1 where application_name='$app_name' and server_port='$server_port'"
#
# Combined execution
$MYSQL db-monitor -u root << EOF INSERT INTO process ( pid, application_name,server_port,listen_port, xmx) VALUES (${pid},'${app_name}',${server_port}, '${net_port:1}', '${Xmx}'); update tbl_application set run_status=1, ins_count=ins_count+1 where application_name='$app_name' and server_port='$server_port'; # Look here ! Look here ! EOF
log "29"
done
done
边栏推荐
猜你喜欢

Video playback | how to become an excellent reviewer of international journals in the field of Geoscience and ecology?
What is cloud native? Why is cloud native technology so popular?

黑马瑞吉外卖之员工信息分页查询

2022,软测人的平均薪资,看完我瞬间凉了...
![[deserialization vulnerability-02] principle test and magic method summary of PHP deserialization vulnerability](/img/03/f80c82d009d21a938911a155dddf6b.png)
[deserialization vulnerability-02] principle test and magic method summary of PHP deserialization vulnerability

Two important laws about parallelism

Types and history of bugs in it circle

JMeter if controller

tcp 服务端接收数据处理思路梳理,以及select: Invalid argument报错 笔记

Sentinel vs Hystrix 限流对比,到底怎么选?
随机推荐
Reprint: getting started with cache coherence
使用Prometheus+Grafana实时监控服务器性能
如何在家中使用 SSH 和 SFTP 协议
[QNX Hypervisor 2.2用户手册]9.2 cmdline
【反序列化漏洞-01】序列化与反序列化简介
The U.S. Department of Homeland Security launched an investigation into the electronic communication records deleted by the secret service during the riots in the Capitol
【Golang】golang实现urlencode urldecode函数
2022, the average salary of the soft tester, after reading it, I was instantly cool
Exceptions about configuring Postgres parameters
Zynq TTC usage
运算放大器 —— 快速复苏笔记[壹](参数篇)
Use of getchar
16 tips for system administrators to use iptables
Fiddler packet capture tool summary
Best practice | using Tencent cloud AI character recognition to realize enterprise qualification certificate recognition
08 [AIO programming]
High frequency written test questions (Weilai)
tcp 服务端接收数据处理思路梳理,以及select: Invalid argument报错 笔记
Neo4j installation tutorial
运算放大器 —— 快速复苏笔记[贰](应用篇)