Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
If what you want is to get the available space on a specific disk volume from within a perl script, I'd do something like this:
my $targ_vol = "/"; my @df_output = `df -k $targ_vol`; # output should be two lines: # first line is column headings, second line is data my %df_data; if ( @df_output ) { my @headings = split( /\s+/, $df_output[0] ); my @data = split( /\s+/, $df_output[1] ); @df_data{@headings} = @data; } print "available on $targ_vol: $df_data{Avail}\n"; # (your version of df might use some string similar to but different f +rom "Avail")
You shouldn't have a problem if you're just looking at "/".

(update: if you're looking at some path other than "/", you need to be careful about knowing whether it's on some different file system, and figuring out whether that file system is currently mounted -- if it isn't, df will give you info about "/" instead. And God help you if it's mounted as NFS, and the NFS server has gone down...)

(update: BTW, when I try "df | egrep '/^'", nothing comes out, which is what I would expect; but if I do "df | egrep '/$'", I get the line that ends with a slash. That's what I don't understand about your usage in the OP -- I think it can't work as posted, unless your "egrep" is way different from mine...)

In reply to Re^4: disk space utilization by graff
in thread disk space utilization by ministry

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2023-10-02 08:18 GMT
Find Nodes?
    Voting Booth?

    No recent polls found