-----Original Message----- From: jandrspencer [mailto:[EMAIL PROTECTED] Sent: Monday, June 16, 2003 7:31 PM To: [EMAIL PROTECTED] Subject: RE: Problem with the Unix 'du' command via perl script
Hello, Tony. Try something like: #!/usr/bin/perl -w use strict; my($size) = `du -sb \/home\/` ; print($size); Regards, Jaimee -----Original Message----- From: Tony Frasketi [mailto:[EMAIL PROTECTED] Sent: Monday, June 16, 2003 4:30 PM To: Dan Muey; [EMAIL PROTECTED] Subject: Re: Problem with the Unix 'du' command via perl script Hello Dan Thanks for the response. I tried your suggestion but I still get the differing sizes... So I'm still looking for a solution. Thanks again Tony Frasketi Dan Muey wrote: > > > I'm having a problem with the results of the Unix 'du' > > command in that I get different results when I execute the > > 'du' command from the Unix command line... > > > > du -sb <directory-path> > > > > and when I execute the 'du' command from a Perl script using > > backtic statement. > > > > my($size) = `du -sb <directory-path>`; > > > > However the differing results only occurs on some directories > > and not on others. > > Probably because du -sb is not retuneing an array like you seem to expect of the size then directory. > Try this: > > my($size,$dir) = split(/\s+/,qx(du -sb $mydir)); > # you don't have to have $dir > # sometimes you also need the entire path to program : /usr/bin/du -sb > # the qx is a better way to do backtick execution, just fyi > > HTH > > DMuey > > > > So far I haven't seen a difference on files, just directories. > > > > Can anyone shed some light on this for me. > > > > Also, I get the daily digest so, I'd appreciate a direct reply. > > > > Thanks in advance > > Tony F. > > > > -- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]