ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 【Linux】EOF使用

【Linux】EOF使用

原创 Linux操作系统 作者:小亮520cl 时间:2016-10-17 16:47:12 0 删除 编辑

  1. #!/bin/sh
  2. HOST=127.0.0.1
  3. USER=root
  4. PASS=ESBecs00
  5. mysql -h$HOST -u$USER -p$PASS << EOF
  6. use test;
  7. select * from tab1;
  8. create table tab1bak as select * from tab1;
  9. select * from tab1bak limit 1;
  10. exit
  11. EOF


  12. info=`mysql -h$HOST -u$USER -p$PASS << EOF
  13. use test;
  14. select * from tab1;
  15. select * from tab1bak limit 1;
  16. exit
  17. EOF`
  18. echo $info

[root@localhost /root ]# sh test.sh 
Warning: Using a password on the command line interface can be insecure.
id      name    passwd  mima    mima2
1       1       1       111     3333333333333
3       3       3       333     3333333333333
4       4       4       5       3333333333333
id      name    passwd  mima    mima2
1       1       1       111     3333333333333
Warning: Using a password on the command line interface can be insecure.
id name passwd mima mima2 1 1 1 111 3333333333333 3 3 3 333 3333333333333 4 4 4 5 3333333333333 id name passwd mima mima2 1 1 1 111 3333333333333

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29096438/viewspace-2126591/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
毕业以后专业任职数据库工程师职位,itpub一直作为自己的笔记记录的地方,blog写的不详细,草书笔记,仅供参考!

注册时间:2013-09-12

  • 博文量
    529
  • 访问量
    1126911