Strange results from FDISK?????

Hi all,

I am writing script that returns the size of each disk or partition when called. I am using FDISK -l and parsing the results to get the result I want. When I execute fdisk -l it shows correct results, BUT when I execute the same thing with results to be put in a variable, I get strange results:

When I want the output to be put in $result variable, fdisk -l returns the files in the folder as well. Another example: When I execute from /:

Can anybody tell me why this thing happens? I'm running mandriva 2008.1 by the way.

Thanks

It could be miss but I would assume that asterisk (*) is interpreted in shell. That's why you are receiving list of everything from your path.

Try to 'grep' other partition, some no active.

Regards
Seba

It could be miss but I would assume that asterisk (*) is interpreted in shell. That's why you are receiving list of everything from your path.

Try to 'grep' other partition, some no active.

Regards
Seba

thanks! yeah apparently it is the * ... any way to fix this flaw?

Thanks

Did you think about other output from fdisk or other tool like sfdisk ?

Seba

 
echo "$result"