> Hi everyone, > Below is the script i am using to delete > few files in the list of user home directories. But > for now I am testing this code and just listing. > So the find command gives a different output when used > in bash prompt than when invoked in script. > Any help would be appreciated > Thak you > Sree. > > #!/usr/bin/perl
use strict; # always use warnings; # usually > $file_name="/etc/passwd.bkp"; > $PATHP="/usr/bin/"; > open ( FIN,$file_name) or die "cannot open $file_name > ",$!; > while($line=<FIN>){ > @user_details = split(":",$line); > my $user= $user_details[0]; > my $Hme = ($user_details[5]); Why parentheses on the second but not the first? You could also use split to store the values directly into $user and $Hme. Why shorten 'home' and capitalize it? > chomp($Hme); > chomp($user); perldoc -f chomp If you are going to chomp something it should be $line not these two. > print "seraching \t ", $Hme ,"\n" ; > > > system(" find $PATHP/find -name \*.txt 1>a.out "); > You haven't told us what the difference is, but out of curiousity why are you using $PATHP to start your search, isn't that what $Hme is for? Shouldn't $PATHP go before the first 'find'? You should dispense with shelling out to 'find' anyways and just use the excellent, File::Find module. > } > > close FIN; > http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>