here document 关闭参数替换

http://www.reddragonfly.org/abscn/here-do

1 #!/bin/bash
  2 #  一个使用'cat'的here document, 但是禁用了参数替换. 
  3 
  4 NAME="John Doe"
  5 RESPONDENT="the author of this fine script"  
  6 
  7 cat <<'Endofmessage'
  8 
  9 Hello, there, $NAME.
 10 Greetings to you, $NAME, from $RESPONDENT.
 11 
 12 Endofmessage
 13 
 14 #  如果"limit string"被引用或转义的话, 那么就禁用了参数替换. 
 15 #  下边的两种方式具有相同的效果. 
 16 #  cat <<"Endofmessage"
 17 #  cat <<\Endofmessage
 18 
 19 exit 0

你可能感兴趣的:(Shell)