posted
ok for soemr eason while read line is actualy waiting for a prompt from the user how do I get it to read a line from a file?
IP: Logged |
Blayne Bradley
unregistered
posted
Okay my script is 99% done I just need to know why it isn't reading lines from the given file, instead it prompts the user to enter a line.
IP: Logged |
Blayne Bradley
unregistered
posted
Okay 'read' l is reading te line i think, but when it gets to the awk command it doesnt work right.
IP: Logged |
posted
Gee, that's a really useful description of the problem. Fortunately for you, by sheer genius I am able to infer from your post what the actual nature of the malfunction is, and can therefore diagnose precisely where in your code the problem lies. And, because I am by nature generous and magnanimous, I shall tell you what the remedy is. Namely, you need to stop doing that thing you're doing wrong, and do it right, instead.
Posts: 10645 | Registered: Jul 2004
| IP: Logged |
Blayne Bradley
unregistered
posted
code:
cat clients | sort > work grep -n '' words > NumDiction Num=$(grep -c '' NumDiction)
d=$(grep '^'$a':' NumDiction | sed 's/[0-9]*://') e=$(grep '^'$a':' NumDiction | sed 's/[0-9]*://')
Password=$d$e
echo "$l $x $Password >> sec
done
done < work
K I added more to my code.
The purpose of the code is to read lines from ma file notably clints but its supposed o be adaptive for say clients2, clients3 so later I'm going to have to use $1,$2 variables.
When each line is read it will use awk to pipe the first and then the last name to the cut command to get the first 3 characters.
Which will then b parsed together to make a userid.
afte that we chekc for uniqueness with the loop which I'm not sure if it works.
After that we use grep and the random number perl generator to get 2 random words from a dictionary file of 476952 words.
And then we append the line, the userid and then the password to "sec".
posted
I don't think you can quite have grasped the point I was making in my previous post. Read this, it's useful stuff. Also, are you going to be showing up for CK tonight? I may need to annex England just to keep up with CC and wil.
Posts: 10645 | Registered: Jul 2004
| IP: Logged |
Blayne Bradley
unregistered
posted
any chane you can come on ICQ KoM and yes hopefully I will be able to show up.
IP: Logged |
Blayne Bradley
unregistered
posted
Okay the problem si that when I run
[linux2-cs.johnabbott.qc.ca]$ bash SecureCase ...
I get a blank, as if tis asking for input.
I am trying to get the read 'l' to read in a while loop each line in the file. But for spome reaosn it is not.
IP: Logged |
posted
First rule of debugging : Put a cout (well, in this case an 'echo') on each line, and figure out where your code is stopping.
Posts: 10645 | Registered: Jul 2004
| IP: Logged |
Blayne Bradley
unregistered
posted
i put an echo immediaely AFTER the read l and nodda. same error.
Like it will run until the uniqeness loop if I manually type Blayne, Bradley after I commence the script but thats not supposed to happen its supposed to take the file I pass it and read off each line but it doesnt.
Also I get deu/null no such directory, this is supposed to check if something already exists. I have no idea how it works it is just what my teacher provided.
IP: Logged |
Blayne Bradley
unregistered
posted
Argh goddamn ym eyesight I think its >&/dev/null
IP: Logged |
Blayne Bradley
unregistered
posted
Okay after the following changes:
while grep "$x" sec >&/dev/null do
c=$[c+1] x=$old$c
done
uniqueness appears to work, however i still have the problem where it will only read the line the user enters not the lines provided by the file.
IP: Logged |
Blayne Bradley
unregistered
posted
Okay Uniqueness definately DOES work HURRAY Anne Murray!