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
$
本文介绍在Linux环境下如何使用heredocuments进行字符串操作,并通过cat命令展示其用法。
9086

被折叠的 条评论
为什么被折叠?



