mirror of
https://github.com/smxi/inxi.git
synced 2025-01-19 08:57:57 +00:00
Fixed a bug reported for partition information output, case where df splits its output lines because the first field is
too long. Now the get partition info function reads back from the last item per record, not from the first one. Since the detection is based on the last item in the line, this should maybe fix that issue. Seen with LVM naming for example. We'll see if this works or not.
This commit is contained in:
parent
ee0740046f
commit
aecf66bac7
14
inxi
14
inxi
|
@ -1,8 +1,8 @@
|
|||
#!/bin/bash
|
||||
########################################################################
|
||||
#### Script Name: inxi
|
||||
#### version: 0.3.28
|
||||
#### Date: November 6 2008
|
||||
#### version: 0.3.29
|
||||
#### Date: November 7 2008
|
||||
########################################################################
|
||||
#### inxi is a fork of infobash, the original bash sys info script by locsmif
|
||||
#### As time permits functionality improvements and recoding will occur.
|
||||
|
@ -1311,12 +1311,16 @@ get_partition_data()
|
|||
{
|
||||
IFS=$'\n'
|
||||
# sample line: /dev/sda2 ext3 15G 8.9G 4.9G 65% /home
|
||||
# $7 = partition name; $3 = partition size; $4 = used, in gB; $6 = percent used
|
||||
A_PARTITION_DATA=( $( df -h -T | egrep '(/|/boot|/var|/home)$' | awk '{print $7 "," $3 "," $4 "," $6 }' ) )
|
||||
# $NF = partition name; $(NF - 4) = partition size; $(NF - 3) = used, in gB; $(NF - 1) = percent used
|
||||
## note: by subtracting from the last field number NF, we avoid a subtle issue with df output, where if
|
||||
## the first field is too long, it will occupy its own line, this way we are getting only the needed data
|
||||
A_PARTITION_DATA=( $( df -h -T | awk '
|
||||
/\/$|\/boot$|\/var$|\/home$/ {
|
||||
print $NF "," $(NF - 4) "," $(NF - 3) "," $(NF - 1)
|
||||
}' ) )
|
||||
IFS="$ORIGINAL_IFS"
|
||||
}
|
||||
|
||||
|
||||
## return uptime string
|
||||
get_uptime()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue