Excellent, another paranoid test.
(echo p; echo q) is neat but fdisk -l more to the point :)
So I'll add this:
fdisk -l | grep -q "$DEVICE.*Linux swap$" || exit 1
thanks!
Judah
Ben Stern <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED]:~# (echo p; echo q) | fdisk /dev/sda
>
> The number of cylinders for this disk is set to 36481.
> There is nothing wrong with that, but this is larger than 1024,
> and could in certain setups cause problems with:
> 1) software that runs at boot time (e.g., old versions of LILO)
> 2) booting and partitioning software from other OSs
> (e.g., DOS FDISK, OS/2 FDISK)
>
> Command (m for help):
> Disk /dev/sda: 300.0 GB, 300069052416 bytes
> 255 heads, 63 sectors/track, 36481 cylinders
> Units = cylinders of 16065 * 512 = 8225280 bytes
>
> Device Boot Start End Blocks Id System
> /dev/sda1 1 250 2008093+ 82 Linux swap
> /dev/sda2 * 251 36481 291025507+ 83 Linux
>
> Command (m for help):
> [EMAIL PROTECTED]:~#
>
> So you could do
>
> (echo p; echo q) | fdisk /dev/sda | grep 'Linux swap' | awk '{print $1}'
>
> to get /dev/sda1 (on my system), or whatever other shell chain of grep and
> so on you cared to do.
>
> GNU parted has some similar method to print the partition table, if you are
> misfortunate enough not to have fdisk.
>
> Ben
> --
> Ben Stern UNIX & Networks Monkey [EMAIL PROTECTED]
> This post does not represent FTI, even if I claim it does. Neener neener.
> UM Linux Users' Group Electromagnetic Networks Microbrew Software
>