TCLUG Development Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [TCLUG-DEVEL:253] how do I....?



Jacqueline,

This might work after you uncomment the "system" command, but check out
the printed command lines first:

>>>>>START>>>>>
#!/usr/bin/perl -w

if (! @ARGV)
{
        print "Usage: $0 <source-file>\n";
        exit 1;
}

while (<>)
{
        chomp;
        my($file, $name, $password) = split;
        print "htpasswd -bc $file $name $password\n";
        #system("htpasswd -bc $file $name $password");
}
<<<<<<END<<<<<<

Also, your perl might be in a different location (which perl), so you
might have to modify the first line to reflect that. Good luck,

Troy

Jacqueline Urick wrote:
> 
> currently spaces
> 
> I left my "mastering regular expressions" book at home too... would have
> been a good day to have that..
> 
> ~j
> 
> Troy Johnson wrote:
> >
> > I would use Perl. What separates the columns in your source file
> > (spaces, commas, ...)?
> >
> > Jacqueline Urick wrote:
> > >
> > > I know there has to to be an easy way to do this with a shell script,
> > > but I don't know how yet. Perhaps one of you can help me. I have a file
> > > that has 3 columns, one for the filename, username and then password.
> > >
> > > I'm trying to setup a bunch of individual htpasswd files.  How do I make
> > > a script that looks at the file and then applies it to htpasswd -bc to
> > > make all my htpasswd files?
> > >
> > > Thanks in advance!
> > >
> > > Jacque
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: tclug-devel-unsubscribe@mn-linux.org
> > > For additional commands, e-mail: tclug-devel-help@mn-linux.org
> >
> > --
> >         <a href="http://umn.edu/~john1536">Troy Johnson</a>
> >
> > If you're not part of the solution, you're part of the
> > precipitate.
> >                                                 -- Stephen Wright
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tclug-devel-unsubscribe@mn-linux.org
> > For additional commands, e-mail: tclug-devel-help@mn-linux.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tclug-devel-unsubscribe@mn-linux.org
> For additional commands, e-mail: tclug-devel-help@mn-linux.org

-- 
	<a href="http://umn.edu/~john1536">Troy Johnson</a>

I installed a skylight in my apartment...
The people who live above me are furious!
						-- Stephen Wright