thanks for your help thomas. As i could not get it to work with shell scripting i did try it on PHP.
## code ## for ($i = 1; $i <= 92; $i++) { $random_password = makeRandomPassword(); $sql = "update random set password = '$random_password' where id = $i"; $q = $db->query($sql); } ## code ## thanks, Louie On Thu, 8 Jul 2004 15:15:04 +0100 (BST), Thomas Adam <[EMAIL PROTECTED]> wrote: > --- Louie Miranda <[EMAIL PROTECTED]> wrote: > #!/bin/bash > > GEN=`pwgen --no-capitalize -N1` > > for i in $GEN > > do > > echo "update dump set random= '$i'"|mysql -uroot insert > > done > > > > -- > > > > I have created this shell script, it updates a specific table on a > > mysql db. Now, the pwgen is a random password generator. When i run > > this program, it only gets 1 variables on all of my fields on the > > mysql. > > Haven't tried it but this loop doesn't do anything. When you run the > comand "pwgen --no-capitalize -N1" as you have it there, only one password > is returned, so that makes your for loop completely redundant. You > therefore need to know how many times you're going to loop to make it > effective, then you can simply do: > > ----------------------------------------------------------- > ####GEN=`pwgen --no-capitalize -N1` > for i in $(seq <num>) do > echo "update dump set random= $(pwgen --no-capitalize -N1)"|mysql -uroot > insert > done > ------------------------------------------------------------ > > Replacing "<num>" above with a number. If it is not fixed, find some other > way of looping. > > -- Thomas Adam > > ===== > "The Linux Weekend Mechanic" -- http://linuxgazette.net > "TAG Editor" -- http://linuxgazette.net > > "<shrug> We'll just save up your sins, Thomas, and punish > you for all of them at once when you get better. The > experience will probably kill you. :)" > > -- Benjamin A. Okopnik (Linux Gazette Technical Editor) > > ___________________________________________________________ALL-NEW Yahoo! Messenger > - sooooo many all-new ways to express yourself http://uk.messenger.yahoo.com > -- Louie Miranda http://www.axishift.com -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]