I'm trying call the first item in the array then put it in a loop to call the next items in order.
set $p = (port-1, port-2, port-3, port-4, exit)
<sourcePort>daughtercard:$P[1]</sourcePort>
if ($p == "exit") then
break
else ($p >> 1)
I know the above code isn't correct. I'm just not sure how to get $p to change ports in order until exit.
thanks in advance for your help.
DK
You may have difficulty getting help with csh scripts, because it is not very good for scripting. See these articles for reasons why that is so:
Top Ten Reasons not to use the C shell
C shell problems
Csh Programming Considered Harmful
In a Bourne-type shell, you might do this:
for port in port-1 port-2 port-3 port-4
do
printf "<sourcePort>daughtercard:%s</sourcePort>\n" "$port"
done
Or even:
printf "<sourcePort>daughtercard:%s</sourcePort>\n" \
port-1 port-2 port-3 port-4