CheeSen
September 7th, 2008, 11:22 AM
can i know how to check user input ? And make sure only alphabetic characters and spaces .
any idea?
mssever
September 7th, 2008, 04:47 PM
can i know how to check user input ? And make sure only alphabetic characters and spaces .
any idea?
if [[ $user_input =~ ^[a-zA-Z ]+$ ]]; then
echo "Good user. Here's a cookie."
else
echo "You didn't enter what I told you to enter. Go to your room."
fiNote that this is Bash-specific. If you call your script with sh, it will fail.
ghostdog74
September 8th, 2008, 03:30 AM
check the bash link in the sig. all the questions that you have posted in other forums including this one can be found in that link.
Powered by vBulletin® Version 4.2.2 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.