[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Detecting disk drives from an installation script



Am 2007-06-14 19:00:47, schrieb Orestes leal:
> 	$fdisk -l | grep dev | gawk -F' *' '{ print $1 }' | gawk -F'/dev/' '{ print $0 }' | grep '/dev/sd' > particiones.txt

Can you tell me which version of "fdisk" you are using?
"fdisk -l" returns nothing at all (¶USER or root)

> 	detecta2=$($fdisk -l | grep $particion | grep + | gawk -F'+' '{ print $2}' | gawk -F' ' '{ print $2 }')
> 	detecta3=$($fdisk -l | grep $particion | grep + | gawk -F'+' '{ print $2}' | gawk -F' ' '{ print $1 }')
> 	$fdisk -l | grep dev | gawk -F' *' '{ print $1 }' | gawk -F'/dev/' '{ print $0 }' | grep '/dev/hd' > particiones.txt
> 	detecta2=$($fdisk -l | grep $particion | grep + | gawk -F'+' '{ print $2}' | gawk -F' ' '{ print $2 }')
> 	detecta3=$($fdisk -l | grep $particion | grep + | gawk -F'+' '{ print $2}' | gawk -F' ' '{ print $1 }')

And why do you run fdisk so many times?

You can use ONCE:

    FDISKOUT=$(fdisk -l)

and then

    echo -e "${FDISKOUT}" | some_command ...
         ^^
    Do not forget it.  :-)

Thanks, Greetings and nice Day
    Michelle Konzack
    Systemadministrator
    Tamay Dogan Network
    Debian GNU/Linux Consultant


-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
Michelle Konzack   Apt. 917                  ICQ #328449886
                   50, rue de Soultz         MSN LinuxMichi
0033/6/61925193    67100 Strasbourg/France   IRC #Debian (irc.icq.com)

Attachment: signature.pgp
Description: Digital signature


Reply to: