2011-03-10 3 views
0

아래의 예에서 todel.txt 파일에 $ a = b 줄을 기다리고있었습니다. 문서의 텍스트 블록을 처리하지 않고 그대로 추가하려면 어떻게합니까?여기에서 사전 처리 됨 doc

[[email protected]]# cat here_example.sh 
#!/bin/sh 
cat > todel.txt << heredoc 
<?php 
$a=b 
# this is comment 
?> 
heredoc 

[[email protected]]# cat todel.txt 
<?php 
=b 
# this is comment 
?> 

답변

3

넣어 시세의 주위에 "히어 닥"다음 bash(1) 사람 페이지에서


#!/bin/sh 
cat > todel.txt << "heredoc" 
<?php 
$a=b 
# this is comment 
?> 
heredoc 
+0

Bash 맨 페이지의 "Here Documents"를 참조하십시오. –

1

:

word의 모든 문자가 인용 경우는 delimiter 견적 제거의 결과입니다 여기에 문서의 word 및 줄이 확장되지 않습니다.

#!/bin/sh 
cat > todel.txt << "heredoc" 
<?php 
$a=b 
# this is comment 
?> 
heredoc 
관련 문제