「ShellScript」testコマンドで文字列を比較するサンプル
書式
test 文字列1 = 文字列2
使用例
cftA="arkgHame"
cftB="arkgame"
if test $cftA = $cftB
then
echo '2つの文字列が等しい!'
else
echo '2つの文字れが等しくない'
fi
実行結果
# sh test01.sh
2つの文字れが等しくない
Coding Changes the World
書式
test 文字列1 = 文字列2
使用例
cftA="arkgHame"
cftB="arkgame"
if test $cftA = $cftB
then
echo '2つの文字列が等しい!'
else
echo '2つの文字れが等しくない'
fi
実行結果
# sh test01.sh
2つの文字れが等しくない