http://linuxcommand.org/wss0030.php
A here script (also sometimes called a here document) is an additional form of I/O redirection. It provides a way to include content that will be given to the standard input of a command.
如何理解呢?不是太明白到底什么是here scripts,请教了
求助:here scripts
-
- 帖子: 104
- 注册时间: 2010-01-23 23:24
- lilydjwg
- 论坛版主
- 帖子: 4258
- 注册时间: 2009-04-11 23:46
- 系统: Arch Linux
- 联系:
Re: 求助:here scripts
代码: 全选
cat <<HereDoc
This is the so-called heredoc writing in the script but as the input.
HereDoc
- xjack
- 帖子: 16
- 注册时间: 2007-11-28 13:04
Re: 求助:here scripts
就是标记之间的所有命令被定向到<<符号之前的那个command
又比如
代码: 全选
#!/bin/bash
lftp << someMessHere
open http://mirror.bjtu.edu.cn/gnu/gcc
get -c README.olderversions
someMessHere
代码: 全选
:<<anyThingHere
被暂时屏蔽的代码
anyThingHere
我们走在囗囗主义光辉的大道上...
-
- 帖子: 919
- 注册时间: 2009-07-01 22:04
-
- 帖子: 104
- 注册时间: 2010-01-23 23:24
Re: 求助:here scripts
昨天有事情,不能上网,不好意思啊。
我还是不理解,什么是here scripts呢?
比如下面一个脚本:
#!/bin/bash
命令一 << 标记号
命令二
命令三
标记号
是命令一被称为here script,还是这个脚本被称为here script呢?还是??
我还是不理解,什么是here scripts呢?
比如下面一个脚本:
#!/bin/bash
命令一 << 标记号
命令二
命令三
标记号
是命令一被称为here script,还是这个脚本被称为here script呢?还是??
-
- 帖子: 104
- 注册时间: 2010-01-23 23:24
Re: 求助:here scripts
已解决:
命令二,命令三 执行后,它的执行结果,被当做 标准输入 传送给 命令一
本来命令一是需要一个文件当参数的,可是这里没有文件,而是命令二和命令三执行的结果,这个结果被当做一个文件了,但是不是一个文件,而只是一个字符串(标准输入),这个重定向被叫做here script。

命令二,命令三 执行后,它的执行结果,被当做 标准输入 传送给 命令一
本来命令一是需要一个文件当参数的,可是这里没有文件,而是命令二和命令三执行的结果,这个结果被当做一个文件了,但是不是一个文件,而只是一个字符串(标准输入),这个重定向被叫做here script。
