• The forum software that supports hummy.tv has been upgraded to XenForo 2.1!

    This upgrade brings a number of improvements including the ability to bookmark posts to come back to later. Please bear with us as we continue to tweak things and open a new thread for any questions, issues or suggestions in Site/Forum Issues.

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/'`"
 

xyz321

Well-Known Member
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)}'`
 

af123

Administrator
Staff member
Happy to continue the conversation, but probably not here!

@Mods - would you mind splitting this thread from post 75 to the Hummy Arms please?
 

af123

Administrator
Staff member
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.
 

af123

Administrator
Staff member
Right - we can rant away to our heart's content now... or is that just me?
(Thanks for moving the posts Brian)
 
OP
F

Fmrl

Member
* - we aren't allowed to use any shell with a history due to security policy constraints.
Fortunately I'm the chap who enforces security policies so I don't have to worry about conforming to them. :p
 
Top