This is topic More Linux help needed in forum Books, Films, Food and Culture at Hatrack River Forum.


To visit this topic, use this URL:
http://www.hatrack.com/ubb/main/ultimatebb.php?ubb=get_topic;f=2;t=039314

Posted by Blayne Bradley (Member # 8565) on :
 
So I need to write a script via emacs or overwise that will form a unique user id and password for someone.

It will take the first 3 letters of both the 1st and last name and merge them together to form a unique user id and if that combination already exist appends a # to it.

Also it will with the RedHat Linux dictionary give each word a number and randomly generate a number which correponds to each word, from there it will take 2 random words and put them together to form a unique password.

How would I go about working on it?
 
Posted by fugu13 (Member # 2859) on :
 
I'm not sure why you need to associate numbers with words from the dictionary instead of just picking two at random straight off, but whatever.

I'm not sure what you see as the issue; the specification seems very straightforward. Which step troubles you?
 
Posted by Blayne Bradley (Member # 8565) on :
 
figuring out what I'm supposed to do in Linux as in writing the actual code, I'm going brain dead for absolutely no reason.
 
Posted by fugu13 (Member # 2859) on :
 
I'm assuming you're supposed to do this in shell scripting?

Well, what shell commands have you learned for manipulating strings? What shell commands are there for the dictionary?
 
Posted by Blayne Bradley (Member # 8565) on :
 
ummm the whole manual.

currently I'm getting cut to work, how ould I only cut the first 3 letters of oth the the given and surnames?
 
Posted by fugu13 (Member # 2859) on :
 
You're going to need to figure out how you're going to interact with the user. You have likely been taught this.

As for how to cut where, I suggest reading man cut. Look at the -c option. Try some things.
 
Posted by Blayne Bradley (Member # 8565) on :
 
I had already about 2 minutes ago figured that by doing:

y="Blayne Bradley"
echo $y

[cs326_2 etc$] Blayne Bradley
[cs326_2 etc$] echo $y | cut -d',' -f1 | cut -c1-3 | cut -d',' -f2 | cut -c2-4
[cs326_2 etc$] BlaBra

that sorta works I did it one at a time command lines and some work maybe needed first to make it usable all in one line.
 


Copyright © 2008 Hatrack River Enterprises Inc. All rights reserved.
Reproduction in whole or in part without permission is prohibited.


Powered by Infopop Corporation
UBB.classic™ 6.7.2