Smart questions
Smart answers
Smart people
Join Tek-Tips Forums
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

fabisu (MIS) (OP)
10 Feb 12 8:03
Hi all,

I would like to know if somebody already did a script to make a "Tree view" of the devices with Parents and Childs with the basic commands lsdev and odmget ?

Thanks,

Fabisu

 
fabisu (MIS) (OP)
10 Feb 12 10:21
Actually it's look like this :

#!/usr/bin/ksh

# Name Specifies the device logical
echo " "
echo "### Devices in the system and their characteristics ###"
lsdev -l $1

# LIST CHILDS FROM THE SELECTED DEVICE
echo " "
echo "### LIST CHILDS FROM THE DEVICE $1 ###"
lsdev -l $1 | awk '{ print "lsdev | grep " $3}' | sh | sort -n

# LIST PARENTS FROM THE SELECTED DEVICE
echo " "
echo "### PARENT DEVICE FOR $1 ###"
lsdev -l $1 -F parent

# LIST PARENTS FROM THE SUB-DEVICE SELECTED
echo " "
a=$(lsdev -l $1 -F parent)
echo "### PARENT DEVICE FOR $a ###"
lsdev -l $(lsdev -l $1 -F parent) -F parent

# LIST ALL THE CHILD DEVICES CONNECTED TO THE DEVICE
echo " "
echo "### ALL THE CHILD DEVICES CONNECTED TO DEVICE $a ###"
lsdev -p $(lsdev -l $1 -F parent)

# LIST ALL THE CHILD DEVICES CONNECTED TO THE DEVICE
echo " "
b=$(lsdev -l $(lsdev -l $1 -F parent) -F parent)
echo "### ALL THE CHILD DEVICES CONNECTED TO DEVICE $b ###"
lsdev -p $(lsdev -l $(lsdev -l $1 -F parent) -F parent)
mrn (MIS)
16 Feb 12 7:27
See https://www.ibm.com/developerworks/mydeveloperworks/wikis/home/wiki/devtree/page/Aix%20scripting%20corner?lang=en

 

Mike

"Whenever I dwell for any length of time on my own shortcomings, they gradually begin to seem mild, harmless, rather engaging little things, not at all like the staring defects in other people's characters."
 

w5000 (TechnicalUser)
29 Feb 12 7:14
maybe this will be usefull:

From:
http://www.tek-tips.com/viewthread.cfm?qid=1535579

$ ./devlist2 hdisk0
hdisk0
scsi0
sisscsia0
pci5
pci0
sysplanar0
sys0


CODE

#!/bin/ksh
dev=$1
echo $dev
devstat=$(lsdev -C -F status -l ${dev} 2>/dev/null)
if [[ $devstat != Available && $devstat != Defined ]]
then
 echo "$dev undefined"
else
 while [[ $dev != sys0 ]]
 do
  dev=$(lsdev -Cl $dev -F parent)
  echo $dev
 done
fi

 

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close