Results 1 to 2 of 2
How to make this script?
1. Write a portable bash shell script called change_password.bash that will
prompt the user for a password. Use a series of if statements to test ...
- 10-24-2007 #1Just Joined!
- Join Date
- Oct 2007
- Posts
- 1
Basic Scipting problem need help for school
How to make this script?
1. Write a portable bash shell script called change_password.bash that will
prompt the user for a password. Use a series of if statements to test if:
1.
The password is NOT 6 or more characters
2.
The password does not contain at least 3 consecutive letters (could be either uppercase or lowercase)
3.
The password does NOT contain any number
4.
The password does NOT contain a non-alphanumeric character (eg. Something not a letter or number.
I can take care of option 1 but have trouble making option 3,2 and 4.
#!/bin/bash
read password
echo $password | wc -m >number
number=`cat number`
if
[ $number -gt 5 ]
then
echo Password cannot contain more then 5 numbers
fi
rm number
for 3 i can only think of this but it wont work for somereason
echo $password | grep [a-zA-z]* >part3
part3=`cat part3`
if [ $part3 != $password ]
then
echo error password cannot contain numbers or special characters
fi
Edit/Delete Message
- 10-24-2007 #2
No homework here. Them's the rules. Sorry.
I presume, though, that you've already googled:
Code:bash tutorial


