私はこれを私の台本に書いています。他の部分もありますが、私はこの部分だけをつかんで進みます。
if [[$# == $year $month $day ]] ; then
cal $day $month $year
fi
実行すると、次のメッセージが表示されます。
[[3: command not found
それでは、問題は何ですか?構文ですか、それとも実際のコマンドですか?
役に立つ場合は、私のスクリプトの残りの部分は次のようになります。
year=$(echo "$year" | bc)
month=$(echo "$month" | bc)
day=$(echo "$day" | bc)
if [[$# == $year $month $day ]] ; then
cal $day $month $year
fi
ベストアンサー1
角かっこの後にスペースを追加する必要があります[[
。
if [[ $# == $year $month $day ]] ; then
cal $day $month $year
fi
そして、あなたが書いたように、これはうまくいきません。合計を文字列またはまったく異なるものと比較してい$#
ます$year $month $day
。おそらく:
if [[ "$#" == "$year$month$day" ]] ; then
cal $day $month $year
fi