The first of these methods
[Email protected] wyb]#Cat One.SH #!/bin/bash# Determines whether the given string is equal to read-P"Please Input a number:"number[-Z $number] &&Echo 'Input Nothing'&& exit1Len=${#number}a=`Echo$number |Cut-C1` forIinch`seq$len ' Dob=`Echo$number |Cut-c $i ' [["$a"!="$b"]] &&EchoNo &&Exit DoneEchoyes[[email protected] wyb]# bash One.SHPlease Input a number:1111111122no[[email protected] wyb]# bash One.SHPlease Input a number:1111111yes[[email protected] wyb]# bash One.SHPlease Input a number:666666666Yes[[email protected] wyb]#
The second method [[email protected] wyb]#Cat 111.SH #!/bin/bash# Determines whether the given string is equal to read-P"Please Input a number:"number[-Z $number] &&Echo 'Input Nothing'&& exit1a=`Echo$number |Cut-C1' B=`Echo$number |TR-d $a ' [-Z $b] &&EchoYes | |Echono[[email protected] wyb]# bash111.SHPlease Input a number:111111yes[[email protected] wyb]# bash111.SHPlease Input a number:123445no[[email protected] wyb]# bash111.SHPlease Input a number:66666Yes[[email protected] wyb]#
Shell script that determines whether the given string is equal.