Heredoc 在此预处理文件
在下面给出的例子中,我期待着这一行 $a=b 在todel.txt文件中。 如何按原样添加here doc文本块而不进行处理Heredoc 在此预处理文件,heredoc,cat,shell,Heredoc,Cat,Shell,在下面给出的例子中,我期待着这一行 $a=b 在todel.txt文件中。 如何按原样添加here doc文本块而不进行处理 [root@localhost]# cat here_example.sh #!/bin/sh cat > todel.txt << heredoc <?php $a=b # this is comment ?> heredoc [root@localhost]# cat todel.txt <?php =b # this is
[root@localhost]# cat here_example.sh
#!/bin/sh
cat > todel.txt << heredoc
<?php
$a=b
# this is comment
?>
heredoc
[root@localhost]# cat todel.txt
<?php
=b
# this is comment
?>
[root@localhost]#cat here\u example.sh
#!/垃圾箱/垃圾箱
cat>todel.txt
在“herdoc”周围加引号:
#!/垃圾箱/垃圾箱
cat>todel.txt在“herdoc”周围加引号:
#!/垃圾箱/垃圾箱
cat>todel.txt来自bash(1)
手册页:
如果word
中的任何字符
quoted后,分隔符
是在word
上删除引号的结果,并且
此处文档中的行不展开
#/垃圾箱/垃圾箱
cat>todel.txt来自bash(1)
手册页:
如果word
中的任何字符
quoted后,分隔符
是在word
上删除引号的结果,并且
此处文档中的行不展开
#/垃圾箱/垃圾箱
cat>todel.txt
#!/bin/sh
cat > todel.txt << "heredoc"
<?php
$a=b
# this is comment
?>
heredoc
#!/bin/sh
cat > todel.txt << "heredoc"
<?php
$a=b
# this is comment
?>
heredoc