Page 1 of 1

Shell Tools (but is it needed?)

Posted: Monday 28th December 2020 1:19pm
by BruceSteers
I have been looking around but not found much about getting disk drive information.

like lsblk

i made a component called gb.shell.tools
https://gitlab.com/bsteers4/gambas/-/tr ... tools/.src

The premise...
Utilise some linux shell commands for things not so available/easy in gambas. (afaik)

So far i've added 2 commands that use lsblk to get disk info.
The first a basic ListDisks() that returns a String[] of disk paths using lsblk -lno "PATH"

The other is ListBlocks() that returns a DeviceInfo[] array with info lsblk finds
DeviceInfo.Path
DeviceInfo.Name
DeviceInfo.Type
DeviceInfo.Size
DeviceInfo.ByteSize
DeviceInfo.UUID
DeviceInfo.FSType
DeviceInfo.Label
DeviceInfo.Mountpoint

My questions are...
1. Is there a more gambas way to do this rather than using lsblk so it's not even needed?

2. Is this a good idea that maybe you could suggest other shell commands you might want added to this component?

3. Is this a terrible idea and i should be looking into external library functions to get disk info?

Cheers anyone
Bruce

Re: Shell Tools (but is it needed?)

Posted: Monday 28th December 2020 4:35pm
by stevedee
Looks like a good idea to me Bruce.

Take a look at the command: df
...this may add something to your info.

Re: Shell Tools (but is it needed?)

Posted: Monday 28th December 2020 8:18pm
by BruceSteers
stevedee wrote: Monday 28th December 2020 4:35pm Looks like a good idea to me Bruce.

Take a look at the command: df
...this may add something to your info.
Thanks Steve , df looks similar,
I'm going to look into making it BSD functional too as that's all Ben has commented about it so may be a thing that could be useful.

Am thinking about somehow making it customisable so it has functions that could easily split a shell commands output into an array or something.