mirror of
https://github.com/smxi/inxi.git
synced 2024-11-17 00:31:19 +00:00
added testing 2 condition as well
This commit is contained in:
parent
38239f43ba
commit
ecde3e165e
29
inxi
29
inxi
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
########################################################################
|
||||
#### Script Name: inxi
|
||||
#### version: 0.9.4-b1-t1
|
||||
#### version: 0.9.4-b1-t2
|
||||
#### Date: January 8, 2009
|
||||
########################################################################
|
||||
#### SPECIAL THANKS
|
||||
|
@ -1903,7 +1903,7 @@ get_hdd_data_basic()
|
|||
percent = used/full
|
||||
print "percent : " percent
|
||||
}' )
|
||||
else
|
||||
if [[ $B_TESTING_2 == 'true' ]];then
|
||||
hdd_used=$( df | gawk '
|
||||
p {
|
||||
if (/^\/dev\/(mapper\/|[hs]d[a-z][0-9]+)/) {
|
||||
|
@ -1925,6 +1925,31 @@ get_hdd_data_basic()
|
|||
END {
|
||||
print c
|
||||
}' )
|
||||
else
|
||||
hdd_used=$( df | 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
|
||||
# it to the next line for that single case
|
||||
if ( NF == 1 ) {
|
||||
getline
|
||||
}
|
||||
# if the first item caused a wrap, use one less than standard
|
||||
if ( $4 ~ /.*\%/ ) {
|
||||
used += $2
|
||||
}
|
||||
# otherwise use standard
|
||||
else if ( $5 ~ /.*\%/ ) {
|
||||
used += $3
|
||||
}
|
||||
# and if this is not detected, give up, we need user data to debug
|
||||
else {
|
||||
next
|
||||
}
|
||||
}
|
||||
END {
|
||||
print used
|
||||
}' )
|
||||
fi
|
||||
|
||||
if [[ -z $hdd_used ]];then
|
||||
|
|
Loading…
Reference in a new issue