Lost Adventurer, Aleks Kirilenko (3D)
LC #42 Pipers Alley

View Full Version : exists command fails... Help needed

10-30-2006, 01:25 PM

I want to query the existence of variables. I tried using the exists command, but it seems it will fail if the variable does not exists..

Can somebody point my to the right syntax to use or an alternative command?


10-30-2006, 03:09 PM
Ok.. Seems the exists command is not designed for querying if variables exist or not.
In the past I've used:

string $whatIsReturn = whatIs "$varName";

Then made a match on the return.

Is there an other way to do this?


11-02-2006, 04:00 PM
i once remeber to do the same.... i found it is better to select object and then query attibute....what i did was i added one User defined attribute.. and later want to edit it.. so code was

string $sel = `ls -sl`;
for ($obj in $sel)
string $attrib[0];
$attrib = `listAttr -ud $obj`;
for ($attr in $attrib)
if ($attr == " your custom code here")
do any action u want;

i don't know if this was what u looking 4 but -ud flag just returns our custom attribs so it helps...


11-03-2006, 11:27 AM
Hi Sunny.

Thanks for answering! What you are talking about seems to be the existance of attributes. Correct me if I'm wrong. I want to query the existence of variables.

11-03-2006, 12:33 PM
grrrr stupid me.....

sorry i just thought u are talking about attr...
without reading post.. sometimes it happens..

CGTalk Moderation
11-03-2006, 12:33 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.