0

私の質問は次のとおりです。以下の関数の v1、v2、v3、v4、および v5 は何ですか? これらは入力パラメーターのように見えますが、何のためにあるのかよくわかりません。彼らが何をしているのか、誰かが少し詳しく説明できますか?

#!/bin/sh
compile()
{
v1="$1*z*"
v2=${2:-"$1*"}
v3=${3:-"$1*/"}
v4=${4:-"."}
v5=${5:-"."}

some other command and cd in here 

}
compile libpng
compile icu "" "" source build
.
.
.
4

1 に答える 1

1

$1などは関数への引数です。

そして、bash(1)man ページのEXPANSIONセクションのParameter Expansionサブセクションから:

   ${parameter:-word}
          Use  Default  Values.  If parameter is unset or null, the expan‐
          sion of word is substituted.  Otherwise, the value of  parameter
          is substituted.
于 2012-07-30T02:48:14.070 に答える