MEL選択オブジェクト(1個のみ)のシェイプノードを選択

//選択オブジェクト(1個のみ)のシェイプノードを選択
string $names= `ls -sl`;
string $Shape
=`listRelatives -f -shapes $names[0]`;
select $Shape[0];


//選択オブジェクト(複数)のシェイプノードを選択
string $objects= `ls -sl`;
$a=`size($objects)`;
for($i=0;$i<$a;$i++)
{
string $ShapeS_01
=`listRelatives -f -shapes $objects[$i]`;
for($ShapeS in $ShapeS_01)
{
select -tgl $ShapeS;
};
};
select -tgl $objects;