quote: Names: User ID's: PASSWORDS CLASSIFIED: boivin, chris chrboi swingbys Pantheon brown, kris kribro Ceratops discussed cizauskas, nick nicciz monogynist tubas cornell, philip phicor megacurie Brazee cuplinskas, justin juscup antelopine peelcrow deangelis, nick nicdea oarialgia pericarp dewan, kanwaljeet kandew population pudic glashan, jeff jefgla circumconic Peramium godbout, samuel samgod dousing-chock ill-definedness hall, michael michal zipless shoguns jonas, tommie tomjon entwined leuko- jones, tom tomjon over-cautious Roxanna jonsson, tomas tomjon Bergh hyocholic katsigiannis, nektarios nekkat annunciates unshowy larivee, benoit benlar burthening revelational manning, raymond rayman unsteered bravas manson, rayleen rayman pycniospore Kanara manzarek, ray rayman petrifies abintestate moufawad, habib habmou Chrysops stall-feed needelman, chris chrnee gestureless Newcastle niedzviecki, benjamin bennie adminstration grannie ohanian, arlen arloha letterheads THC rideough, eric eririd nonmorality venosity singer, mark marsin light-limbed wiking viapiano, francis fravia balk knightess zey, adam adazey thir monoplacular
Its not putting in the spaces I want, nor is it appending numbers, wtf am I doing wrong??
Posted by Miro (Member # 1178) on :
Please, STOP SHOUTING!
Thank you. Sorry, I don't know anything about Linux.
Posted by Blayne Bradley (Member # 8565) on :
there r u happy now? And do you actually know something about linux that can help?
Posted by Theaca (Member # 8325) on :
I don't know anything, but thank you for changing it.
Posted by fugu13 (Member # 2859) on :
wow, I'm not sure I even want to try to figure out your logic in this . . .
And you even choose to invoke perl in it. If you're going to use perl, just freakin' use perl.
Also, let me introduce you to the notion of comments. Write a comment saying what each line is doing (less in a literal sense, more in an evocative sense).
I suspect its not creating the numbers because of output buffering -- the file isn't being created until after all the echos are "stacked". A quick "fix" might be to flush the output after each echo. However, this is both kludgy and will quickly become inefficient. Consider using some sort of array with string indices, either in the shell or using awk (awk would be far better) to hold how many times a given userid has been used.
Posted by Blayne Bradley (Member # 8565) on :
quote: #This script will generate a randomly created user id and password from the redhat linux dictionary
spc1=", " spc2=" "
#assings a path to a variable #then it assigns numbers to the beginning of each line in the redhat dictionary #counts the number of words total
echo "Names: User ID's: PASSWORDS CLASSIFIED:" #output format while read line #reads lines of names from file "clients" do
w=$(echo $line | cut -d' ' -f2 | cut -c1-3) #assigns the first 3 chars from the last name to w q=$(echo $line | cut -c1-3) #assigns the first 3 chars from first name to q
uida=$w$q #assigns w and q to uida uidb=$uida assigns a double of uida to uidb
num=0 #initializes num to 0 while grep "$uidb" $2 >& /dev/null #if if finds a multiple of a userid do loop do let $num=$num+1 #assigns the value of num and increments it by 1 for each multiple usr id uidb=$uida$num #the userid + the number becomes uidb done
echo $uidb >> $2 #testing
#creates a random number by invoking pearl, and using grep, finds the line that matches the given number #using sed, blanks out the number and the user id
rnum1=$(perl randm.pl $nwords) idnum1=^"$rnum1": pw1=$(grep "$idnum1" mywords | sed 's/^[0-9]*://') rnum2=$(perl randm.pl $nwords) idnum2=^"$rnum2": pw2=$(grep "$idnum2" mywords | sed 's/^[0-9]*://')
I invoked pearl to get a random number, I don't know pearl so I don't code in it, I used pearl function because it was suggested to me.
quote: boivin, chris brown, kris cizauskas, nick cornell, philip cuplinskas, justin deangelis, nick dewan, kanwaljeet glashan, jeff godbout, samuel hall, michael jonas, tommie jones, tom jonsson, tomas katsigiannis, nektarios larivee, benoit manning, raymond manson, rayleen manzarek, ray moufawad, habib needelman, chris niedzviecki, benjamin ohanian, arlen rideough, eric singer, mark viapiano, francis zey, adam
a client list.
Posted by Blayne Bradley (Member # 8565) on :
ok after fiddling around with some testing, I realize it is giving a number but its not outputting it with the $output variable, can aynone tell me whats wrong?
Posted by fugu13 (Member # 2859) on :
Write outline to stderr directly before you echo it. Ponder this. Try writing the pieces that seem wrong to stderr directly after their creation, and ponder this. Perhaps test other points.
This is called debugging.
Posted by Blayne Bradley (Member # 8565) on :
quote: #This script will generate a randomly created user id and password from the redhat linux dictionary
#asgings a path to a variable #then it assigns numbers to the beginning of each line in the redhat dictionary #counts the number of words total
echo "Names: User ID's: PASSWORDS CLASSIFIED:" > sec #output format echo "" >> sec echo "" >> sec while read line #reads lines of names from file clients do
w=$(echo $line | cut -d' ' -f2 | cut -c1-3) #assigns the first 3 chars from the last name to w q=$(echo $line | cut -c1-3) #assigns the first 3 chars from first name to q
uida=$w$q #assigns w and q to uida uidb=$uida #assigns uida to uidb num=0 #initializes num to 0
while grep "$uidb" $2 >& /dev/null #if if finds a multiple of a userid do loop do let num++ #assigns the value of num and increments it by 1 for each multiple usr id uidb=$uida$num #the userid + the number becomes uidb done
echo $uidb > $2 #phony output that annoyed me, so now it is decoration
#creates a random number by invoking pearl, and using grep, finds the line that matches the given number #using sed, blanks out the number and the user id
rnum1=$(perl randm.pl $nwords) idnum1=^"$rnum1": pw1=$(grep "$idnum1" mywords | sed 's/^[0-9]*://') rnum2=$(perl randm.pl $nwords) idnum2=^"$rnum2": pw2=$(grep "$idnum2" mywords | sed 's/^[0-9]*://')
echo "Your file is now ready within the file "sec" in your PWD"
It is now complete.
quote: Names: User ID's: PASSWORDS CLASSIFIED:
boivin, chris chrboi sugi Ante-nicene brown, kris kribro slinkingly microhistochemical cizauskas, nick nicciz disqualifications chromoctye cornell, philip phicor relaster Ritch cuplinskas, justin juscup raunge Tombalbaye deangelis, nick nicdea sissyish grassplot dewan, kanwaljeet kandew Race Commelinaceae glashan, jeff jefgla volkswagen sabby godbout, samuel samgod devitrifying matamata hall, michael michal Trilbie incandescent jonas, tommie tomjon nonlucrative Tasman jones, tom tomjon1 Nyctanthes kindest jonsson, tomas tomjon2 bell-metal Amargo katsigiannis, nektarios nekkat procrastinatory wail larivee, benoit benlar cardamine paravent manning, raymond rayman Fante nonpropagandist manson, rayleen rayman1 inconcoction uncompellable manzarek, ray rayman2 apple-pie draftmanship moufawad, habib habmou -log isometrically needelman, chris chrnee clanfellow stonegall niedzviecki, benjamin bennie thixotropic Ixelles ohanian, arlen arloha contractee consentient rideough, eric eririd lummy prowler singer, mark marsin Humarock Catskills viapiano, francis fravia outquaff quatty zey, adam adazey nonpermitted heteropolarity
The problem was mostly due to output and some other stuff that I'll mention tomorrow after some rest.
Posted by HollowEarth (Member # 2586) on :
Blayne, did you every try posting this at a forum more dedicated to this kind of thing? I'm not trying to discourage you from posting it here, but you might find that there are more people who can help you at other forums.
Posted by Blayne Bradley (Member # 8565) on :
... if I knew other forums.....
Posted by tern (Member # 7429) on :
LinuxForums.org and LinuxQuestions.org, as well as CodeNewbie.com.