mirror of
https://github.com/dunwu/linux-tutorial.git
synced 2024-04-15 19:55:24 +08:00
28 lines
378 B
Bash
28 lines
378 B
Bash
#!/usr/bin/env bash
|
|
|
|
if [[ -z $1 ]]; then
|
|
echo "please input first param";
|
|
exit
|
|
fi
|
|
|
|
if [[ -z $2 ]]; then
|
|
echo "please input second param";
|
|
exit
|
|
fi
|
|
|
|
if [[ $1 > $2 ]]; then
|
|
echo "\$1 > \$2";
|
|
elif [[ $1 < $2 ]]; then
|
|
echo "\$1 < \$2";
|
|
else
|
|
echo "\$1 != \$2";
|
|
fi
|
|
|
|
# execute: ./ifDemo.sh abc abc
|
|
# output:
|
|
# $1 == $2
|
|
|
|
# execute: ./ifDemo.sh abc ab
|
|
# output:
|
|
# $1 != $2
|