比較したい2つの式があるので、次のように書きました。
result=(`echo "${strings[0]}" | grep -i -w "${strings[1]}" | wc -w`)
しかし、結果をエコーすると空になります...なぜですか?
..
より多くのコード:
#!/bin/bash
function checkStrings {
strings=$*
result=(`echo "${strings[0]}" | grep -i -w "${strings[1]}" | wc -w`)
echo $result ${strings[*]}
}
checkStrings "Avi" "Avi"
出力: 0 アビ アビ
「Blue Moon」からの回答文字列=$*を文字列=($*)に変更
それは動作しますthnx