早教吧 育儿知识 作业答案 考试题库 百科 知识分享

这个shell脚本中的函数什么意思?完全看不懂啊usage(){cat&2$0:[options][src]dst-v:outputactionsperformed.-eenv-var:onlytakeactionifenv-varissetto"y".-ooption:onlytakeactionifoptionissetto"y".-pperms:chmodsty

题目详情
这个shell脚本中的函数什么意思?完全看不懂啊
usage()
{
cat &2
$0:[options] [src] dst
-v :output actions performed.
-e env-var :only take action if env-var is set to "y".
-o option :only take action if option is set to "y".
-p perms :chmod style permissions for dst.
-d :make dst directory if it doesn't exist
-S :don't strip after installing
-a text :append text to dst.
-A pattern :only append text if pattern doesn't exist in file
-l link :dst is a link to 'link'.
-s sym-link :dst is a sym-link to 'sym-link'.
if "src" is not provided,basename is run on dst to determine the
source in the current directory.
multiple -e and -o options are ANDed together.To achieve an OR affect
use a single -e/-o with 1 or more y/n/"" chars in the condition.
if src is a directory,everything in it is copied recursively to dst
with special files removed (currently CVS and Subversion dirs).
EOF
exit 1
}
▼优质解答
答案和解析
这个函数里面用到Here Documents,主要功能是将两个!EOF标签中间的内容cat 重定向到STDERR标准错误输出里面.
>&2 就是 重定向到STDERR标准错误输出 的意思.