Me too : ) Unfortunately, awk isn't available during boot, use sed instead.
Little bit rusty on sed but I think this will do the trick...
display "Disk: `df -k | grep /dev/sda2 | sed 's/\(.*\) \(.*\) \(.*\)/\2/'`"
Me too : ) Unfortunately, awk isn't available during boot, use sed instead.
I was going to suggest something like this in order to overcome the 5% error due to the ext3fs reserved blocks.Me too : ) Unfortunately, awk isn't available during boot, use sed instead.
display `df /dev/sda2 |awk '(/^\/dev/){printf ("%d%%\n",$3/$2 * 100)}'`
Code:humax# df -h /dev/sda2 | sed '1d;s/ */ /g' | cut -d\ -f5 49%
df -h /dev/sda2 | grep /dev/sda2 | cut -c 52-55
True, but I used sed to replace tr : )cut is cheating
humax# df -h /dev/sda2 | sed '1d;s/.* \([0-9]*%\).*/\1/'
49%
Code:humax# df -h /dev/sda2 | sed '1d;s/.* \([0-9]*%\).*/\1/' 49%
Well, in this case mostly sed : )Careful, af will take exception and tell you it's bash or something, not Linux!
* - we aren't allowed to use any shell with a history due to security policy constraints.