[Novalug] Perl calling multiple shell commands - wrapping my head around it.
Miles D. Oliver
miles.d.oliver at gmail.com
Wed Feb 1 14:53:25 EST 2012
The whole idea behind this is to create/delete users in the vendors DB from
the CLI based upon attributes in an LDAP OU.
Because of the way this nasty CLI works its probably just best to.
Call the CLI twice in the perl scrip with 'open()'
Once to get all the output of users and permissions from the Vendors DB all
at once, I can do this with a single single 'backtick' command.
Then do my comparisons of user permissions in the Vendor DB against the
Then pass the results of the comparison to a real bash script with
arguments to do the user and permission modifications in the Vendors DB.
I was hoping to do this in a single perl script for ease but the CLI is
very limited in what I can do with it.
The whole idea is to eliminate another Administration interface for user
On Wed, Feb 1, 2012 at 1:50 PM, Jon LaBadie <novalugml at jgcomp.com> wrote:
> On Wed, Feb 01, 2012 at 12:59:23PM -0500, Miles D. Oliver wrote:
> > I just turned 50.. Can anybody tell me when 'senior moments' start???
> > This is working and I can pass multiple commands to the bash shell and
> > connect to the DB fine but it looks like I have to do some additional
> > reading to understand how to save the output of the shell command into
> > something I can work with, say to get into an array
> > @array = `shell command` isn't working in this context because I think
> > a fork of a different process.
> > open SHELL, "|/bin/bash" or die "Couldn't open bash shell $!";
> > print SHELL $conn;
> > print SHELL $cmd1;
> > foreach $line(@array) (want array to be output of $cmd1;
> > ....
> > Any thoughts?
> Created a named pipe (FIFO) with mknod
> Redirect $cmd1 to write to the fifo.
> Open the fifo for reading and input the results into @array.
> Remove the fifo.
> Jon H. LaBadie novalugml at jgcomp.com
> 11226 South Shore Rd (703) 787-0688 (H)
> Reston, VA 20190 (609) 477-8330 (C)
> Novalug mailing list
> Novalug at calypso.tux.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Novalug