Not quite: lsvg -o in AIX (i suppose this is AIX, yes?) gives a list of volume groups in varyon state, not "every volume group". If there is a volume group but you did a varyoffvg <vg> then it will not be included in this list, although it will be displayed in lsvg .
Also notice that in HACMP-clusters nowadays (HACMP 7.1.x and 7.2) VGs are in a "somewhat varyon" state on the passive node(s) if you get your disks from a SAN and the LUNs are in the "no_reserve" state. I am not sure if a lsvg -p would succeed on such a VG even though the disks are there.
Wouldn't it make a lot of sense to include the name of the VG with problems if there is one? You also should not use "echo" in a ksh (you do use ksh, no?) but print , which is a shell-builtin. If you want to be 101% POSIX-compliant use neither but printf .
Anyway, consider this, change the error message to your liking and/or remove the -u2 if you want to redirect the error message to stdout instead of stderr:
vgcheck ()
{
typeset chVG=""
lsvg -o | while read chVG ; do
if ! lsvg -p "$chVG" | grep -qi "missing" ; then
print -u2 "Error: ($chVG) disks missing"
return 1
fi
done
print "OK:PASSED"
return 0
}