Answers:
从bash手册页:
${parameter:-word} Use Default Values. If parameter is unset or null, the expansion of word is substituted. Otherwise, the value of parameter is substituted.
在您的情况下,您将使用
$ function svcp(){ def_msg =“ $ 2的dev分支” echo svn copy“ repoaddress / branch / $ 1.0.x”“ repoaddress / branch / dev / $ 2” -m \“ $ {3:-$ def_msg} \”; } $ svcp 2令人兴奋的新资料 svn复制repoaddress / branch / 2.0.x repoaddress / branch / dev / exciting_new_stuff -m“令人兴奋的new_stuff的开发分支” $ svcp 2令人兴奋的新事物“统治世界的秘密秘方” svn复制repoaddress / branch / 2.0.x repoaddress / branch / dev / exciting_new_stuff -m“世界统治的秘密秘诀” $
如果您对生成的svn命令感到满意,则可以删除echo命令