「shell入門」文字列を比較するサンプル
shellコード
#!/bin/bash
a="123″
b="1234″
c="123″
if [ “$a"x != “$b"x ]
then
echo “a != b"
fi
if [ “$a"x = “$c"x ]
then
echo “a == c"
fi
空白文字列をチェックする
if [ -z “$d" ]
then
echo “d is empty"
fi
Coding Changes the World
shellコード
#!/bin/bash
a="123″
b="1234″
c="123″
if [ “$a"x != “$b"x ]
then
echo “a != b"
fi
if [ “$a"x = “$c"x ]
then
echo “a == c"
fi
空白文字列をチェックする
if [ -z “$d" ]
then
echo “d is empty"
fi