Hello,
can someone help, RE does not work if I take string from shell command, last version is storing to the arrays, but still does not work.
If you will put directly $userid="uid=100(oracle)" and $homeowner="oracle" it works !!! Where is the error, please.
execution:
$ ./test.pl
your id output: uid=100(oracle)
owner of the directory: oracle
Test 3.1.1.1 failed
source code:
$cat ./test.pl
#!/usr/bin/perl
$awkcmd = "/usr/bin/awk";
@user = `id | $awkcmd '{ print \$1}'`;
@info = `ls -l $ENV{'ORACLE_HOME'} | grep bin | $awkcmd '{ print \$3}'`;
$userid=$user[0];
$homeowner=$info[0];
if ($userid =~ /${homeowner}/) {
print "your id output: ".$userid."\n";
print "owner of the directory: ".$homeowner."\n";
print "Test 3.1.1.1 successfull"."\n";
}
else{
print "your id output: ".$userid."\n";
print "owner of the directory: ".$homeowner."\n";
print "Test 3.1.1.1 failed"."\n";;
}
can someone help, RE does not work if I take string from shell command, last version is storing to the arrays, but still does not work.
If you will put directly $userid="uid=100(oracle)" and $homeowner="oracle" it works !!! Where is the error, please.
execution:
$ ./test.pl
your id output: uid=100(oracle)
owner of the directory: oracle
Test 3.1.1.1 failed
source code:
$cat ./test.pl
#!/usr/bin/perl
$awkcmd = "/usr/bin/awk";
@user = `id | $awkcmd '{ print \$1}'`;
@info = `ls -l $ENV{'ORACLE_HOME'} | grep bin | $awkcmd '{ print \$3}'`;
$userid=$user[0];
$homeowner=$info[0];
if ($userid =~ /${homeowner}/) {
print "your id output: ".$userid."\n";
print "owner of the directory: ".$homeowner."\n";
print "Test 3.1.1.1 successfull"."\n";
}
else{
print "your id output: ".$userid."\n";
print "owner of the directory: ".$homeowner."\n";
print "Test 3.1.1.1 failed"."\n";;
}