Well, in that scenario, yes. :)
My first /dev takes more than one line apparently, but I doubt the
student machines will have much more than /dev/sda, or at least won't
be using LVM for a while. So for your a system that doesn't explode
the first line into 2, change the head -3 to a head -2. We could also
search for the first line ending with a / and a newline.
By the time we teach them LVM, they'll probably already understand
disk space, so that shouldn't be an issue. :)
---
[EMAIL PROTECTED]:~/testscripts$ df -H
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/space-space
1.4T 924G 417G 69% /
varrun 1.6G 934k 1.6G 1% /var/run
varlock 1.6G 0 1.6G 0% /var/lock
udev 1.6G 91k 1.6G 1% /dev
devshm 1.6G 13k 1.6G 1% /dev/shm
lrm 1.6G 41M 1.6G 3%
/lib/modules/2.6.24-21-generic/volatile
/dev/sda1 50G 289M 47G 1% /boot
//dc01/scott 134G 52G 83G 39% /mnt/scott
gvfs-fuse-daemon 1.4T 924G 417G 69% /home/cmadmin/.gvfs
-----
On Mon, Oct 6, 2008 at 12:06 PM, Robert Citek <[EMAIL PROTECTED]> wrote:
> On Mon, Oct 6, 2008 at 11:04 AM, Scott Kokotovitch
> <[EMAIL PROTECTED]> wrote:
>> ----------------------
>> #!/bin/sh
>> THING=`df -H | head -3 | tail -1 | awk '{print $4}' | sed 's/\(.*\)./\1/'`
>> # echo $THING
>> if [ $THING -gt 55 ]; then
>> echo 'Greater than 55'
>> else
>> echo 'Lower than 55'
>> fi
>
> Given this:
>
> $ df -H
> Filesystem Size Used Avail Use% Mounted on
> /dev/sda2 56G 46G 7.3G 87% /
> varrun 1.6G 115k 1.6G 1% /var/run
> varlock 1.6G 0 1.6G 0% /var/lock
> udev 1.6G 91k 1.6G 1% /dev
> devshm 1.6G 0 1.6G 0% /dev/shm
>
> THING is 1.6:
> $ THING=`df -H | head -3 | tail -1 | awk '{print $4}' | sed 's/\(.*\)./\1/'`
> $ echo $THING
> 1.6
>
> Is that the expected result?
>
>> Shouldn't it be pretty easy to throw this in without disrupting much?
>
> Yup.
>
> Regards,
> - Robert