cat> 文件名<<eof
用来建立文件
在这以后输入任何东西 都是在 文件里的
输入完成以后EOF结尾 表明结束
好比
cat > 1.txt <<eof
1
2
3
4
5
eof
就是建立1.txt这个文件里面内容是 1 2 3 4 5
============================================
cat <<EOF与cat <<-EOF的区别(原文:http://blog.csdn.net/apache0554/article/details/45508631)
两个都是获取stdin,并在EOF处结束stdin,输出stdout。apache
可是<<-是什么意思呢?spa
先来看man中的说明:.net
If the redirection operator is <<-, then all leading tab characters are stripped from input lines and the line containing delimiter. 翻译
翻译过来的意思就是:若是重定向的操做符是<<-,那么分界符(EOF)所在行的开头部分的制表符(Tab)都将被去除。code
这能够解决因为脚本中的天然缩进产生的制表符。blog
通俗一点的解释:ip
在咱们使用cat <<EOF时,咱们输入完成后,须要在一个新的一行输入EOF结束stdin的输入。EOF必须顶行写,前面不能用制表符或者空格。get
好比,下面的语句就不会出错:input
- cat <<EOF
- Hello,world!
- EOF
而<<-就是为了解决这一问题:
- cat <<-EOF
- Hello,world!
- EOF
这就是<<和<<-的区别。