[Rule-list] detecting hard drive space

Devon devon at tuxfan.homeip.net
Tue Apr 9 01:34:35 EEST 2002


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Monday 08 April 2002 05:17 pm, hairylarry at deltaboogie.com wrote:
> Devon,
>
> Ok, I have isolated the three factors from the lines starting with Disk
> and Units. If I multiply them together it should give me bytes.
>
> How do I get the fdisk piped output into a shell variable so we can do
> the multiplication and come up with a figure?

Probably lots of better ways to do it, but this should work. Try this and 
edit to taste. :)

#!/bin/sh
device="/dev/hda"
cylinders=\
`fdisk -l $device | grep Disk | cut -d "," -f 3 | cut -d " " -f 2`
size=\
`fdisk -l $device | grep Units | cut -d "*" -f 1 | cut -d " " -f 5`
bytes=\
`fdisk -l $device | grep Units | cut -d "*" -f 2 | cut -d " " -f 2`
let TOTAL="$cylinders"*"$size"*"$bytes"
echo $TOTAL
exit

- -D

- -- 

pgp key:  http://www.tuxfan.homeip.net:8080/pgpkey.txt
Red Hat Linux 7.2 in 8M of RAM: http://www.freesoftware.fsf.org/rule/

- --
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE8shr7eMAUbzJhSVcRAogVAJ9i9LVRwMaFb10cO1qB9eWAajeayACgv7YB
yK2tnB7z6A5KPmn7cH7C5SY=
=qi4s
-----END PGP SIGNATURE-----

_______________________________________________
Rule Project HOME PAGE:  http://www.freesoftware.fsf.org/rule/
Original Rule Development Site http://savannah.gnu.org/projects/rule/Rule-list at mail.freesoftware.fsf.org
http://mail.freesoftware.fsf.org/mailman/listinfo/rule-list



This full static mirror of the Run Up to Date Linux Everywhere Project mailing list, originally hosted at http://lists.hellug.gr/mailman/listinfo/rule-list, is kept online by Free Software popularizer, researcher and trainer Marco Fioretti. To know how you can support this archive, and Marco's work in general, please click here