in reply to system commands and returns

system runs a separate process, so you're spawning a new process, running su in that, and then exiting. I think you need to stay in the process once you've switched users. Perhaps something like IPC::ShellCmd::Sudo (I haven't used it) would help?


Improve your skills with Modern Perl: the free book.

Replies are listed 'Best First'.
Re^2: system commands and returns
by Anonymous Monk on Nov 29, 2011 at 19:17 UTC

    chromatic

    i think this would cause me to save the password in a file, correct? i would like to avoid this option, if at all possible

      I don't see why; it's not obvious reading the module's code that that's necessary, and in any case you could always prompt for it in your program, right?


      Improve your skills with Modern Perl: the free book.

        @chromatic

        I have tried to access IPC::ShellCmd but been unsuccessful. I have Perl 5.8.8 but I am getting the command "Can't locate IPC/ShellCmd.pm".

        It may be worth mentioning that I am using Perl that is packaged with an IBM product. I am not sure if this makes a difference or not, so I am not able to test it.