mirror of
https://github.com/smxi/inxi.git
synced 2024-11-17 00:31:19 +00:00
test of output
This commit is contained in:
parent
5b246b5dd7
commit
1948f9df0e
33
inxi
33
inxi
|
@ -1861,17 +1861,18 @@ get_hdd_data_basic()
|
|||
{
|
||||
local hdd_used=''
|
||||
|
||||
# dfdata="Filesystem 1K-blocks Used Available Use% Mounted on
|
||||
# /dev/hdc7 5289348 2811800 2208864 57% /
|
||||
# tmpfs 1037688 0 1037688 0% /lib/init/rw
|
||||
# udev 10240 116 10124 2% /dev
|
||||
# tmpfs 1037688 0 1037688 0% /dev/shm
|
||||
# /dev/hdc8 8420132 4218360 3774044 53% /home
|
||||
# /dev/hdc5 32981408 20955204 12026204 64% /media/hd2
|
||||
# /dev/sdb1 390700768 188926868 201773900 49% /media/Snusmumrikken
|
||||
# /dev/sda1 732572000 248156936 484415064 34% /media/Mr. Big"
|
||||
# hdd_used=$( echo "$dfdata" | gawk '
|
||||
hdd_used=$( df | gawk '
|
||||
dfdata="Filesystem 1K-blocks Used Available Use% Mounted on
|
||||
/dev/hdc7 5289348 2811800 2208864 57% /
|
||||
tmpfs 1037688 0 1037688 0% /lib/init/rw
|
||||
udev 10240 116 10124 2% /dev
|
||||
tmpfs 1037688 0 1037688 0% /dev/shm
|
||||
/dev/hdc8 8420132 4218360 3774044 53% /home
|
||||
/dev/hdc5 32981408 20955204 12026204 64% /media/hd2
|
||||
/dev/sdb1 390700768 188926868 201773900 49% /media/Snusmumrikken
|
||||
/dev/sda1 732572000 248156936 484415064 34% /media/Mr. Big"
|
||||
# hdd_used=$( df | gawk '
|
||||
hdd_used=$( echo "$dfdata" | gawk '
|
||||
|
||||
/^\/dev\/(mapper\/|[hs]d[a-z][0-9]+)/ {
|
||||
# this handles the case where the first item is too long
|
||||
# and makes df wrap output to next line, so here we advance
|
||||
|
@ -1879,25 +1880,29 @@ get_hdd_data_basic()
|
|||
if ( NF == 1 ) {
|
||||
getline
|
||||
}
|
||||
|
||||
if ( $4 ~ /.*\%/ ) {
|
||||
used += $2
|
||||
available += $3
|
||||
print "b: " $1
|
||||
}
|
||||
else if ( $5 ~ /.*\%/ ) {
|
||||
used += $3
|
||||
available += $4
|
||||
print "a: " $1
|
||||
}
|
||||
else {
|
||||
next
|
||||
}
|
||||
}
|
||||
END {
|
||||
print used
|
||||
print "used: " used
|
||||
print "available: " available
|
||||
}' )
|
||||
|
||||
if [[ -z $hdd_used ]];then
|
||||
hdd_used='na'
|
||||
fi
|
||||
echo hdd_used $hdd_used
|
||||
echo hdd_used "$hdd_used"
|
||||
|
||||
# create the initial array strings:
|
||||
# disk-dev, capacity, name, usb or not
|
||||
|
|
Loading…
Reference in a new issue