【发布时间】:2009-12-18 19:23:13
【问题描述】:
有人能解释一下下面代码中的“
mysql test<<E0Q
Select * from signins
我会尝试自己搜索,但符号很难搜索...
谢谢, 丹
【问题讨论】:
有人能解释一下下面代码中的“
mysql test<<E0Q
Select * from signins
我会尝试自己搜索,但符号很难搜索...
谢谢, 丹
【问题讨论】:
这是一个“这里的文件”,见http://www.linuxjournal.com/article/3771
【讨论】:
Here docs,或者一种将大文本块轻松导入程序的方法。
【讨论】:
它不仅用于管道。例如,Linux From Scratch 演练中使用的脚本将 heredocs 与cat 命令和输出重定向运算符 (>) 结合使用。这是一个这样的例子:
user@domain ~$ cat >test.c <<EOF
int main(void){return 0;}
EOF
user@domain ~$
这会将
【讨论】:
它们被称为此处文档。来自手册:
这里的文档
This type of redirection instructs the shell to read input from the current source until a line containing only word (with no trailing blanks) is seen. All of the lines read up to that point are then used as the standard input for a command. The format of here-documents is: <<[-]word here-document delimiter
【讨论】: