in reply to Unix size again
in thread Unix size

my ($location) = @_; $location =~ s{ ([\\\']) }{ '\\' . $1 }gex; # crude escape print "\n".'Calculating Scan Statistics...'."\n"; my $cmd = "du -sk '$location'"; warn $cmd; # let's see what's actually getting executed! my $size = `cmd`; print "$size";

Replies are listed 'Best First'.
Re^2: Unix size again
by Anonymous Monk on Feb 08, 2012 at 09:10 UTC

    Its not working gives this when run: du -sk '' at test_2.pl line 5

      Then $location is not what you think it is. Debug your script.

      Well, then that means that $location is an empty string, or perhaps undefined. So the problem lies elsewhere in your code. Post more of the script.