i create a script like this:
set oplist = `execute(“opls -d sphere*”)`
if ($oplist) then
echo ok
else
echo Sorry, object not found.
endif
but i got error: invalid if syntax, i checked that this happened probably because the $oplist has an array-like value. I mean , it works if the $oplist contain single numeric value or string etc.
anyone know how to fix it?
the goal with that ‘if’ is to check if the opls command return any value or not(null)
clay~
if - syntax error
2595 1 2- clay
- Member
- 58 posts
- Joined: July 2005
- Offline
- Antoine Durr
- Member
- 321 posts
- Joined: July 2005
- Offline
clayYeah, this could expand to something like:
i create a script like this:
set oplist = `execute(“opls -d sphere*”)`
if ($oplist) then
if (geo1 geo2 geo3) then
which is pretty non-sensical. Instead, try:
if (“$oplist” != “”) then
Another approach for these kinds of things is:
if (`argc(execute(“opls -d sphere*”))` > 0) then
This will run if the number of words (ops, in your case) is greater than zero.
– Antoine
echo ok
else
echo Sorry, object not found.
endif
but i got error: invalid if syntax, i checked that this happened probably because the $oplist has an array-like value. I mean , it works if the $oplist contain single numeric value or string etc.
anyone know how to fix it?
the goal with that ‘if’ is to check if the opls command return any value or not(null)
clay~
-
- Quick Links