[dwm] [ot] df, flexible kilobyte blocks

From: <Deleuze_AT_gmx.net>
Date: Sat, 03 Jan 2009 05:13:53 +0100

Helo,

in this times everyone has to be flexible, so get your special df
version, which can easily display 113K Byte Blocks ;)

./evildf
usage: ./evildf /Mountpoint Blocksize(1024/n)

,bash evildf / 3.5
evildf: 1024/3.5: syntax error in expression (error token is ".5")

#Filesystem Size Used Available Capacity Mounted on
#/dev/dsk/c0t0d0s0 2.70868e+07 2.55476e+07 1268302 96% /

,bash evildf / 0
evildf: 1024/0: division by 0 (error token is "0")
#Filesystem Size Used Available Capacity Mounted on
#/dev/dsk/c0t0d0s0 0 0 0 96% /

,bash evildf / -1
printing layout in -1024K blocks:
#Filesystem Size Used Available Capacity Mounted on
#/dev/dsk/c0t0d0s0 -7739085 -7299323 -362372 96% /

,bash evildf / 9
printing layout in 113K blocks:(hrhrhr :P)
#Filesystem Size Used Available Capacity Mounted on
#/dev/dsk/c0t0d0s0 69651765 65693907 3261348 96% /

HTH and btw. there seems to be no 'block-size= option' on solaris.

===

#!/bin/bash

if [ -z $1 ]; then
echo "usage: ./`basename $0` /Mountpoint Blocksize(1024/n)"
exit 1
fi

x=$2
#x=2

echo "printing layout in $((1024/$x))K blocks:"

part=`/usr/xpg4/bin/df -Ptk $1|tail -1| awk '{print $1,"\t"}'`
proz=`/usr/xpg4/bin/df -Ptk $1|tail -1| awk '{print $5,"\t" }'`
dyn=`/usr/xpg4/bin/df -Ptk $1 | tail -1 | awk '{ print \
"\t",$2*'$x', "\t",$3*'$x', "\t",$4*'$x', "\t"}'`
echo -e 'Filesystem\t Size Used Available Capacity Mounted on'
echo -e $part $dyn "$proz$1"

===

:Patches, similar Programs are welcome..

Gruss
Stefan

-- 
Sensationsangebot verlängert: GMX FreeDSL - Telefonanschluss + DSL 
für nur 16,37 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K1308T4569a
Received on Sat Jan 03 2009 - 04:13:53 UTC

This archive was generated by hypermail 2.2.0 : Sat Jan 03 2009 - 04:24:04 UTC