Validating user input in shell script Videochat rutule
The last line of the function tests the answer to see if it's value is "yes" or "y", thereby setting the exit status of the function.
Note that if a timeout was specified and any answer (valid or invalid) is entered the timeout is turned off. The benefits to using parameter validation attributes is two-fold.First, you do not have to write the error messages yourself. You never enter the actual code if the parameter validation does not pass and the code does not get bloated from all the input checking.Input validation, in its simplest terms, is just putting some kind of constraint on the kind of information the user can pass to your script.Perhaps your script exposes a -Computer Name parameter to enable the user of your script to run it against different computers.