shell Introduction to programming #!/bin/sh #The function used to compare the two numbers vara=$1
varb=$2 if [ -z $vara ] || [ -z $varb ] then echo "please input hte two
numbers" exit 1 fi if [ $vara -eq $varb ] ; then echo "the $vara = $varb" else
if [ $vara -gt $varb ] then echo "the $vara > $varb" elif [ $vara -lt $varb ]
then echo "the $vara < $varb" fi fi
[root@localhost sourcetemp]# ./compare 1 2
the 1 < 2
[root@localhost sourcetemp]# ./compare 4 3
the 4 > 3
[root@localhost sourcetemp]# ./compare 3 3
the 3 = 3
Need attention :
1.#!/bin/bash finish writing sth. #!bin/bash Resolution not found
2.#!/bin/bash Can be written as #!/bin/sh sh connection to bash
3.if [ $var -eq $varb ] ; then
All have spaces
Technology
Daily Recommendation