Add function to quickly check storage.
This commit is contained in:
30
files/dwm/storage.function
Normal file
30
files/dwm/storage.function
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
function storage {
|
||||
location="$1"
|
||||
quiet="$2"
|
||||
|
||||
if [[ -z $location ]]; then
|
||||
echo "ERROR: Location must be passed. $location"
|
||||
fi
|
||||
|
||||
if [[ -n "$quiet" ]]; then
|
||||
df -h $location | tail -n 1 | awk {print $5", "$3"/"$2""}
|
||||
else
|
||||
df -h $location | tail -n 1 | awk {print $5" Free, "$3"/"$2" Used"}
|
||||
fi
|
||||
}
|
||||
|
||||
function storage-root {
|
||||
storage / $1
|
||||
}
|
||||
function storage-root-dwm {
|
||||
storage-root q
|
||||
}
|
||||
|
||||
function storage-home {
|
||||
storage /home $1
|
||||
}
|
||||
function storage-home-dwm {
|
||||
storage-root q
|
||||
}
|
||||
Reference in New Issue
Block a user