my $pig_file = system("ls /home/mrdemo1/pig.jar"); my $pig_directory = system("ls /home/mrdemo1/pigtmp"); open (PH,">>/home/mrdemo1/pig_profile_tmp") or die $!; my $pig_directory_path = `echo \'export PIGDIR=/home/mrdemo1\' >> /home/mrdemo1/pig_profile_tmp`; my $hadoop_site_path = `echo \'export HADOOPSITEPATH=/etc/hadoop/conf\' >> /home/mrdemo1/pig_profile_tmp`; my $bash_profile_run = system(". /home/mrdemo1/pig_profile_tmp); my $pig_directory_path_exist = `runuser -l mrdemo1 -c 'echo \$PIGDIR'`; my $hadoop_site_path_exist = `runuser -l mrdemo1 -c 'echo \$HADOOPSITEPATH'`; chomp($pig_directory_path_exist); chomp($hadoop_site_path_exist); print " PATH IS $pig_directory_path_exist and $hadoop_site_path_exist"; #if ( "$pig_directory_path_exist" ne "/home/mrdemo1" || "$hadoop_site_path_exist" ne "/etc/hadoop/conf" ) #{ # print " PIGDIR NOT SET. SET PIGDIR TO /home/mrdemo1 using command ..................runuser -l mrdemo1 -c 'export PIGDIR=/home/mrdemo1' OR SET HADOOPSITEPATH TO /etc/hadoop/conf using command runuser -l mrdemo1 -c 'export HADOOPSITEPATH=/etc/hadoop/conf' OR SET BOTH \n\n"; # print " Exiting...................\n\n"; #} output [root@r01mgt ~]# perl testscript.pl Bareword found where operator expected at testscript.pl line 12, near "print " PATH" (Might be a runaway multi-line "" string starting on line 7) (Do you need to predeclare print?) String found where operator expected at testscript.pl line 13, near "#if ( "" (Might be a runaway multi-line "" string starting on line 12) (Missing semicolon on previous line?) Scalar found where operator expected at testscript.pl line 13, near "#if ( "$pig_directory_path_exist" (Missing operator before $pig_directory_path_exist?) String found where operator expected at testscript.pl line 13, near "$pig_directory_path_exist" ne "" (Missing operator before " ne "?) String found where operator expected at testscript.pl line 13, near "mrdemo1" || "" Scalar found where operator expected at testscript.pl line 13, near "" || "$hadoop_site_path_exist" (Missing operator before $hadoop_site_path_exist?) String found where operator expected at testscript.pl line 13, near "$hadoop_site_path_exist" ne "" (Missing operator before " ne "?) String found where operator expected at testscript.pl line 15, near "# print "" (Might be a runaway multi-line "" string starting on line 13) (Missing semicolon on previous line?) Bareword found where operator expected at testscript.pl line 15, near "# print " PIGDIR" (Missing operator before PIGDIR?) Bareword found where operator expected at testscript.pl line 15, near "'export PIGDIR=/home/mrdemo1' OR" (Missing operator before OR?) Bareword found where operator expected at testscript.pl line 15, near "'export HADOOPSITEPATH=/etc/hadoop/conf' OR" (Missing operator before OR?) Backslash found where operator expected at testscript.pl line 15, near "BOTH \" (Do you need to predeclare BOTH?) Backslash found where operator expected at testscript.pl line 15, near "n\" String found where operator expected at testscript.pl line 16, near "# print "" (Might be a runaway multi-line "" string starting on line 15) (Missing semicolon on previous line?) Bareword found where operator expected at testscript.pl line 16, near "# print " Exiting" ...........