binsh

useful posix sh scripts
git clone ssh://anon@git.pastanoggin.com
Log | Files | Refs | LICENSE

commit 9f21d2b944d60d998495ac26bb934456e284c78f
parent 6e6a3f2a743829518a1c44eebff39ba04f3c0446
Author: noodle <noodle@pastanoggin.com>
Date:   Thu, 24 Jul 2025 08:41:50 +0300

dfs: quote grep regex to prevent shell parsing

Diffstat:
Mdfs | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dfs b/dfs @@ -2,7 +2,7 @@ # prints df(1) then the totals of each statistic # TODO: align the numbers for totals to match df(1) output set -e -df -h | grep ^[a-zA-Z/] +df -h | grep '^[a-zA-Z/]' df -k | awk ' function human(kb) { order=1; while (kb >= 1000) { kb /= 1024; order++ }; return sprintf("%.1f%c", kb, substr("KMGTPE", order, 1)) } NR > 1 && /^\/dev/ { devs++; size += $2; used += $3; avail += $4; cap += $5 }