Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash
- CheckCorrection()
- {
- rm input.txt
- if [ $2 = "mobile" ]
- then
- echo $1>>input.txt
- if [ $(grep -ci -rv [a-z] input.txt) = 1 ]
- then
- result="correct"
- else
- result="incorrect.please repeat"
- fi
- fi
- if [ $2 = "email" ]
- then
- echo $1>>input.txt
- if [ $(grep -ci -rv '/\A[^@]+@([^@\.]+\.)+[^@\.]+\z/' input.txt) = 1 ]
- then
- result="correct"
- else
- result="incorrect.please repeat"
- fi
- fi
- }
- echo "Введите $4 :"
- read value
- CheckCorrection $value $2
- while [ "$result" != "correct" ]
- do
- echo $result
- read value
- CheckCorrection $value $2
- done
- echo "Success"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement