The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Unique value added garric Shell Programming and Scripting 2 05-18-2008 08:20 AM
Unique Result unibboy Shell Programming and Scripting 6 01-29-2008 05:19 AM
getline with a unique gozer13 Shell Programming and Scripting 6 03-03-2005 12:20 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-21-2005
azmathshaikh azmathshaikh is offline
Registered User
  
 

Join Date: Mar 2005
Location: Hyderabad, India
Posts: 22
Unique String

Hi,

While creating users in one of my application, the passowrd for the user has to obey the following rules.

password cannot be the same as the user name
password must have a minimum of six characters
password must have a maximum of 100 characters
password must have at least one alpha character
password must have at least one numeric character.
password cannot contain two consecutive equal alphabets (aa)

I am creating users using a script and generating random string for the password. But the last rule worries me. How can we check the passowrd to find out if there are two consecutive alphabets(Rule 6)???

Thanks in advance
  #2 (permalink)  
Old 08-21-2005
zazzybob's Avatar
zazzybob zazzybob is offline Forum Advisor  
Registered Geek
  
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
Here's something to start you off - probably a more effecient way but anyway

Code:
$ cat ./azmath.ksh
#!/bin/ksh

passwd=bbcddefghhi12334

echo "${passwd}" | awk 'BEGIN { old_a = "unset" }
                        { split ($0,a,"") }
                        END { for ( i = 0; i <= length($0); i++ )
                             {
                                if ( old_a == a[i] && a[i] !~ /[0-9]/ ) {
                                   printf( "Duplicate %s\n", a[i] )
                                }
                                old_a = a[i]
                             }
                        }'
$ ./azmath.ksh
Duplicate b
Duplicate d
Duplicate h
Cheers
ZB
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:33 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0