Files
env-ansible/files/dwm/storage.function

31 lines
501 B
Bash

#!/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
}