There's a tendency that inputs entered contain "hidden" characters when a user
pressed "Backspace" or accidentally press Control characters or there has been
cases where the user entered an invalid length input.
I need a script (preferably Korn or Bournes Shell script & not Perl) to be able to validate
the inputs :
read idnum?"Pls enter your identification number: "
typeset -u idnum
... validation codes which I need help with .....
The validation criteria for idnum are :
a) it has to start with 's' or 'S' & if it doesn't, prompt user again to re-enter &
echo to say it has to start with 'S'
b) total length of idnum including the first character 'S' (but exclude the <ENTER> which
the user hit after entering everything) should be between 8-9 & if not, prompt user
to re-enter & echo to say length of identification number must be between 8-9
c) all characters after S should be numeric values of 0-9 except the last character
which can be either a numeric or an alphabet
d) if a "space", "backspace" or hidden characters or other than numbers & the last
character (being a numeric or alphabet) is entered (as mentioned in point c above),
prompt user to re-enter & echo to say a corrupt/invalid character has been entered