echo eof linux
linux eof
2013-05-07 19:36:59 zuixinnet 阅读数 376
$ORACLE_HOME/bin/sqlplus -s "user/pwd@sid_pd as sysdba" <<eof >/u01/log

eof用来创建文件在这之后输入任何东西 都是输出到了log 文件里
输入完成之后EOF结尾  代表结束
比如

[oracle@dg u01]$ $ORACLE_HOME/bin/sqlplus -s " / as sysdba" <<eof >/u01/log
> select count(*) from scott.emp;
> eof
[oracle@dg u01]$ more log

  COUNT(*)
----------
        14

 

 

linux EOF
2011-06-15 17:14:00 zxx2403 阅读数 3595
		/apps/oracle/product/10.2.0/db_1/bin/sqlplus -s scott/tigger@$orcl <<EOF >> $StatusLogFile

			whenever oserror exit FAILURE
			whenever sqlerror exit sql.sqlcode      
			set head off
			set pagesize 0
			set feedback off
			set serveroutput on size 1000000
			VARIABLE ln_return_code  NUMBER;
			alter session set nls_date_format='RRRRMMDD';
			declare
				ln_count integer;
			begin
				xxx_package.xx_proc;
				dbms_output.put_line(ln_count);
			end;
/
EOF

说明 <<EOF 的意思是 EOF 以后的内容,作为流输入 传给前面的应用, 直到遇到EOF ,中止输入..

注意 EOF 前面不能有空格

linux EOF
2011-06-14 11:09:00 tansuozhe2010 阅读数 753

<html>
<head>
<title>Wrox Online Trivia Quiz</title>
<script language="JavaScript" type="text/javascript">
//(1)变量的名字不一致导致了页面显示不出来,所以流程要清楚,变量出现在了什么地方要有数
//(2)如何将其题目内容显示在页面上?如何将javascript语言和页面语言混合起来用?
//
var questionNumber;
function answerCorrect(questionNumber,answer)
{
    var correct = false;
    if(answer == answers[questionNumber])
    {
        correct = true;
    }
    return correct;
}
function getQuestion()
{
   questionNumber = Math.floor(Math.random() * (questions.length));
   var questionHTML = "<p>" + questions[questionNumber][0] + "</p>";
   var questionLength = questions[questionNumber].length;
   var questionChoice;
   for (questionChoice = 1;questionChoice < questionLength;questionChoice++)
   {
      questionHTML = questionHTML + "<input type=radio name=radQuestionChoice"
      if (questionChoice == 1)
      {
         questionHTML = questionHTML + " checked";
      }
      questionHTML = questionHTML + ">";
      questionHTML = questionHTML + questions[questionNumber][questionChoice];
      questionHTML = questionHTML + "<br>";
   }
   document.QuestionForm.txtQNumber.value = questionNumber + 1;
   return questionHTML;
}
function buttonCheckQ_onclick()
{
    var answer = 0;
    while(document.QuestionForm.radQuestionChoice[answer].checked != true)
    {
        answer++;
    }
    answer = String.fromCharCode(65 + answer);
    if(answerCorrect(questionNumber,answer) == true)
    {
        alert("You got it right");
    }
    else
    {
        alert("You got it wrong");
    }
    window.location.reload();
}
var questions = new Array();
var answers = new Array();
questions[0] = new Array();
questions[0][0] = "The Beatles were";
questions[0][1] = "A sixties rock group from Liverpool";
questions[0][2] = "Four musically  gifted  insects";
questions[0][3] = "German cars";

// fourth choice
questions[0][4] = "I don't know. Can I have the questions on Baseball please?";

// assign answer for question 1
answers[0] = "A";
questions[1] = new Array();
questions[1][0] = "Homer Simpson's favorite food is";
questions[1][1] = "Fresh salad";
questions[1][2] = "Doughnuts";
questions[1][3] = "Bread and water";
questions[1][4] = "Apples";
answers[1] = "B";

questions[2] = new Array();
questions[2][0] = "Lisa Simpson plays which musical instrument?";
questions[2][1] = "Clarinet";
questions[2][2] = "Oboe";
questions[2][3] = "Saxophone";
questions[2][4] = "Tubular bells";
answers[2] = "C";
</script>
</head>
<body>

<form name="QuestionForm">
Question
<input type="text" name=txtQNumber size=1>
<script language="JavaScript" type="text/javascript">
   document.write(getQuestion());
</script>
<input type="button" value="Check Question" name="buttonCheckQ"
   onclick="return buttonCheckQ_onclick()">
</form>
</body>
</html>


linux EOF
2014-11-21 13:02:52 lovepqj 阅读数 456

通过SSH可以做到远程登录。通过EOF可以做到SSH SHELL 自动化。EOF中的内容被作为子指令传递到子shell执行。Cool.

参考:http://blog.sina.com.cn/s/blog_483e43060101ay3d.html

<<EOF

(内容)
EOF
linux EOF
2018-06-20 07:37:53 earthchinagl 阅读数 326

在平时的运维工作中,我们经常会碰到这样一个场景:
执行脚本的时候,需要往一个文件里自动输入N行内容。如果是少数的几行内容,还可以用echo追加方式,但如果是很多行,那么单纯用echo追加的方式就显得愚蠢之极了!
这个时候,就可以使用EOF结合cat命令进行行内容的追加了

下面就对EOF的用法进行梳理:
EOF是END Of File的缩写,表示自定义终止符.既然自定义,那么EOF就不是固定的,可以随意设置别名,在linux按ctrl-d就代表EOF.
EOF一般会配合cat能够多行文本输出.
其用法如下:
<<EOF        //开始
....
EOF            //结束

还可以自定义,比如自定义:
<<BBB        //开始
....
BBB              //结束

通过cat配合重定向能够生成文件并追加操作,在它之前先熟悉几个特殊符号:
< :输入重定向
> :输出重定向
>> :输出重定向,进行追加,不会覆盖之前内容
<< :标准输入来自命令行的一对分隔号的中间内容.

下面通过具体实例来感受下EOF用法的妙处:
1)向文件test.sh里输入内容。
[root@slave-server opt]# cat << EOF >test.sh 
> 123123123
> 3452354345
> asdfasdfs
EOF
[root@slave-server opt]# cat test.sh 
123123123
3452354345
asdfasdfs

追加内容
[root@slave-server opt]# cat << EOF >>test.sh 
> 7777
> 8888
EOF
[root@slave-server opt]# cat test.sh 
123123123
3452354345
asdfasdfs
7777
8888

覆盖
[root@slave-server opt]# cat << EOF >test.sh
> 55555
EOF
[root@slave-server opt]# cat test.sh 
55555

2)自定义EOF,比如自定义为wang
[root@slave-server opt]# cat << wang > haha.txt
> ggggggg
> 4444444
> 6666666
wang
[root@slave-server opt]# cat haha.txt 
ggggggg
4444444
6666666

3)可以编写脚本,向一个文件输入多行内容
[root@slave-server opt]# touch /usr/local/mysql/my.cnf               //文件不提前创建也行,如果不存在,EOF命令中也会自动创建
[root@slave-server opt]# vim test.sh
#!/bin/bash

cat > /usr/local/mysql/my.cnf << EOF                                      //或者cat << EOF > /usr/local/mysql/my.cnf
[client]
port = 3306
socket = /usr/local/mysql/var/mysql.sock

[mysqld]
port = 3306
socket = /usr/local/mysql/var/mysql.sock

basedir = /usr/local/mysql/
datadir = /data/mysql/data
pid-file = /data/mysql/data/mysql.pid
user = mysql
bind-address = 0.0.0.0
server-id = 1
sync_binlog=1
log_bin = mysql-bin

[myisamchk]
key_buffer_size = 8M
sort_buffer_size = 8M
read_buffer = 4M
write_buffer = 4M

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 
port = 3306
EOF

[root@slave-server opt]# sh test.sh           //执行上面脚本
[root@slave-server opt]# cat /usr/local/mysql/my.cnf    //检查脚本中的EOF是否写入成功
[client]
port = 3306
socket = /usr/local/mysql/var/mysql.sock

[mysqld]
port = 3306
socket = /usr/local/mysql/var/mysql.sock

basedir = /usr/local/mysql/
datadir = /data/mysql/data
pid-file = /data/mysql/data/mysql.pid
user = mysql
bind-address = 0.0.0.0
server-id = 1
sync_binlog=1
log_bin = mysql-bin

[myisamchk]
key_buffer_size = 8M
sort_buffer_size = 8M
read_buffer = 4M
write_buffer = 4M

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 
port = 3306

---------------------------------------------------------------------------------
下面分享一个自动新建分区并挂载的脚本:

1
2
3
4
5
6
7
8
9
10
11
12
13
[root@es-node1 ~]# cat auto_add_disk.sh         
#!/bin/bash
fdisk /dev/sdb <<EOF
n
p
1
 
 
wq
EOF
 
/sbin/mkfs.ext4 /dev/sdb1 &&  /bin/mkdir -p /data && /bin/mount /dev/sdb1 /data
echo 'LABEL=data_disk /data ext4 defaults 0 2' >> /etc/fstab

出处:https://www.cnblogs.com/kevingrace/p/6257490.html

linux echo

阅读数 235

Linux - echo

阅读数 60

linux echo

阅读数 437

linux echo

阅读数 1122

linux - echo

阅读数 294

没有更多推荐了,返回首页