LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   How to use shell script to get removable devices? (https://www.linuxquestions.org/questions/programming-9/how-to-use-shell-script-to-get-removable-devices-160646/)

slownet 03-21-2004 03:17 PM

How to use shell script to get removable devices?
 
Hi,

I am writing a program in RedHat (9.0) to display whole list of devices to users. To simplify programming, I am using shell scripts to collect devices information.

The question is: how can I get removable devices (USB, Fireware, etc) information using shell scripts? Is there any command or API to call?

Thanks.

AMMullan 03-22-2004 01:22 PM

If you look in /proc you'll find a bunch of files for this - theres a file for CPU info, memory info etc...

There should be enough information in there for you to get these devices (althoguh with some of it you might want to learn sed, [B]awk[/B and possibly cut (just handy for getting information out of chunky files)...

slownet 03-23-2004 10:16 AM

I know how to use awk and cut, but is there any better way to get hardware information? There directory structure is not same for each type of removable device. Also, I am not quite sure about those directory structures.

There is a command Kudzu in redhat that seems good enough to configure device. But I don't know how to call that command to get device information.

Do you know how to use kudzu command (or API) or other commands to get device information? Thanks a lot!


All times are GMT -5. The time now is 08:17 PM.