Perl Scripting problem

From: Dearman, Richard (rdearm1@UIC.EDU)
Date: Fri Jul 12 2002 - 15:12:30 EDT


A friend of mind is having a probelm passing a password to in a perl script.
Any of you Perl wizards out there figure this out and send it to me. The
password she is trying to enter is "candy".

Thanks
Brian

#!/usr/bin/perl

print "su to user oracle\n";

#system("su oracle");

### I need for this script to accept the password candy instead of prompting
me for the password

system('su oracle <<EOF >/dev/null
candy
EOF');

$testoracle = $?;

print "test_oracle = $testoracle\n";

if ($testoracle != 0) {
   print "\n";
   system("mail -s su ccoupet\@blah.com");
   print "Cannot su to user oracle - rc of su is $testoracle\n";
die;
}

system("exit");

$testexit = $?;

print "test_exit = $testexit\n";

if ($testexit != 0) {
   print "\n";
   system("mail -s su ccoupet\@blah.com");
   print "Cannot exit from su to user oracle - rc of su is $testexit\n";
die;
}

print "successfull exit from user oracle\n";

***************************EMAIL DISCLAIMER*************************** This
email and any files transmitted with it may be confidential and are intended
solely for the use of th individual or entity to whom they are addressed.
If you are not the intended recipient or the individual responsible for
delivering the e-mail to the intended recipient, any disclosure, copying,
distribution or any action taken or omitted to be taken in reliance on it,
is strictly prohibited. If you have received this e-mail in error, please
delete it and notify the sender or contact Health Information Management
312.996.3941.



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:16:03 EDT