代码:
[root@oracle-cluster-3 shell]# cat match_list.sh list_a="2 3 5 67 90" current_num=91 after_all=108 is_in="no" for list_item in $list_a do #echo "current in list is: [$list_item]" if [ $list_item -gt $current_num ] then is_in="yes" fi #echo "" done echo "current num is: [$current_num]" echo "does current num in the list? [$is_in]" [root@oracle-cluster-3 shell]# [root@oracle-cluster-3 shell]# sh match_list.sh current num is: [91] does current num in the list? [no] [root@oracle-cluster-3 shell]# [root@oracle-cluster-3 shell]#
——————————————
Done。