jtony@genoa:~/learn/shell$ cat ifthenelse.sh
#!/bin/bash
if test $1 -gt $2
then
echo "$1" is greater than "$2"
fi
echo "This comes after if-then unconditionally."
#!/bin/bash
if test $1 -gt $2
then
echo "$1" is greater than "$2"
fi
echo "This comes after if-then unconditionally."
Here are some other numerical operators you may want to try out:
- -eq: equal to
- -ne: not equal to
- -lt: less than
- -le: less than or equal to
- -gt: greater than
- -ge: greater than or equal to
No comments:
Post a Comment