Re: perl interactive system commands
From: Andrew Gaffney (agaffney_at_technaut.darktalker.net)
Date: 11/27/03
- Next message: Drieux: "Re: Sockets and Daemonizing - was Re: Count the no of times a script is called"
- Previous message: Rob Dixon: "Re: Glob and space in directory name"
- Next in thread: Drieux: "Re: perl interactive system commands"
- Maybe reply: Drieux: "Re: perl interactive system commands"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 27 Nov 2003 08:56:17 -0600 To: beginners@perl.org
rhlinux wrote:
> elslam 3alikom,
> i wanna run an interactive system command through my program
> for example i wanna add a user with its password that is given in the program not by the user, do any one here have any idea how can i do so in perl
> i tried
>
> quote:
> ------------------------------------------------------------------------------
> system(passwd username )
> ------------------------------------------------------------------------------
>
> but this takes the password from the user, i have also tried a lot of attributes to passwd command but nothing worked
I've tried just about every method you can think of to get this to work correctly.
Unfortunately, passwd is coded to only accept from a tty. The only thing I could think of
to get it to work is to create a pseudo tty (pty) and use that to send input to the passwd
program. I have no idea how to do this, though. There may also be an easier way.
-- Andrew Gaffney
- Next message: Drieux: "Re: Sockets and Daemonizing - was Re: Count the no of times a script is called"
- Previous message: Rob Dixon: "Re: Glob and space in directory name"
- Next in thread: Drieux: "Re: perl interactive system commands"
- Maybe reply: Drieux: "Re: perl interactive system commands"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]