here document

 here 文档用于ftp的自动交互:
 
  ip=bldc.ih.lucent.com; user=jepeng; pass=Cool13579;
 dir=/bld/jepeng/cs1342/aplg_cdma/ia32_obj; file=LMCPmain;
 ftp -n <  open $ip
 user $user $pass
 bin
 cd $dir
 get $file
 bye
 !

saveload< ${RT0LABid}
${INITIALS}
${RT0num} ${FAFnum}
${LoadName}
${STATUS}
y
FIN
it is here documents
the command "saveload" takes all following lines as arguments.

often ,here documents is as below
saveload< 123
...
!
FIN是一个标签
表示它之前的都是here document.
FIN can replace with any character

here document 就是批量输入
$ which saveload
/home/coolclf/bin/saveload
将下面的文本批量输入到脚本saveload中
saveload< ${RT0LABid}
${INITIALS}
${RT0num} ${FAFnum}
${LoadName}
${STATUS}
${RT0LABid}
${CLFDEST}
${LoadName}
${STATUS}
${RT0LABid}
${LOADDEPS}
${CLFDEST}
y
FIN

why 不能两个<< here文档连着
print < ...
EOF

print < ...
EOF
错误将第二个EOF改成EOF2
标识重名了

 

 

你可能感兴趣的:(shell)