Skip to content

Commit 8696f01

Browse files
committed
disk-usage.sh: purge bash-isms
1 parent b468795 commit 8696f01

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

disk-usage.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@
66
# http://www.cyberciti.biz/faq/mac-osx-unix-get-an-alert-when-my-disk-is-full/
77

88
check() {
9-
FS="$1"
10-
OUTPUT=($(LC_ALL=C df -P ${FS}))
11-
CURRENT=$(echo ${OUTPUT[11]} | sed 's/%//')
12-
[ $CURRENT -gt $threshold ] && \
13-
echo "$FS: file system usage at $CURRENT%" && \
9+
FS=$1
10+
CURRENT=$(df -P "$FS" | tail -n1 | awk '{print $5}' | sed 's/%//')
11+
test "$CURRENT" -gt "$threshold" &&
12+
echo "$FS: file system usage at $CURRENT%" &&
1413
return 1
1514
return 0
1615
}

0 commit comments

Comments
 (0)