linux中关于here documents的写法,是关于cat的用法:
#!/bin/sh
# we have less than 3 arguments. Print the help tesxt:
if [ $# -lt 3 ]; then
cat << HELP
ren -- renames a number of files using sed regular expressions
USAGE:
ren 'regexp' 'replacement' files...
EXAMPLE:
rename all *.HTM files in *.html:
ren 'HTM$' 'html' *.HTM
HELP
exit 0
fi
用 cat 命令,以<<开始,后面接HELP单词,然后以HELP结束,中间的内容就是可以显示的内容。
$ ./ren
ren -- renames a number of files using sed regular expressions
USAGE:
ren 'regexp' 'replacement' files...
EXAMPLE:
rename all *.HTM files in *.html:
ren 'HTM$' 'html' *.HTM
$