in reply to Re^3: Automating sudo actions
in thread Automating sudo actions
Thanks for all the great suggestions. Unfortunately, changing the environment is quite impossible. I'm stuck having to 'sudo bash'. If I can't automate through that (icky) interface, I'm stuck largely copy/pasting chunks of commands.
Why are you stuck to 'sudo bash'? Why can't you do `sudo perl_script`?
Well, even if you can't control sudo configuration and only "bash" is available for execution, then try something like
Read perldoc perlipc. Section Bidirectional Communication with Another Process. Maybe this will help you to do simple automation.
my $pid = open(OUT, "|-");
die "Can't fork\n" unless defined $pid;
exec "sudo bash";
die "oops no exec\n";
$| = 1;
print "echo hi there\nexit\n";