sed...

Fmrl

Member
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.
Code:
display `df /dev/sda2 |awk '(/^\/dev/){printf ("%d%%\n",$3/$2 * 100)}'`
 
Happy to continue the conversation, but probably not here!

@Mods - would you mind splitting this thread from post 75 to the Hummy Arms please?
 
Don't learn bash, learn Bourne shell (sh). You can always learn the Bash extensions later.

<rant>
I'm tired of people coming for interview for jobs involving shell programming (we don't use bash) and not realising the difference!
They're the same people who almost invariably tell us that our "Up arrow is broken"* and the "Cursor keys aren't working in vi" (and also tend to pronounce vi as in vie instead of Vee Eye).
</rant>

* - we aren't allowed to use any shell with a history due to security policy constraints.
 
Right - we can rant away to our heart's content now... or is that just me?
(Thanks for moving the posts Brian)
 
Back
Top