The following works with csh builtins but does not sort.
#!/bin/csh -f
set ARRAY=( one two three one three )
echo "<$ARRAY>"
set NARRAY=( )
foreach i ( $ARRAY:q )
if ( " $NARRAY " !~ *" $i "* ) then
set NARRAY=( $NARRAY:q $i:q )
endif
end
set ARRAY=( $NARRAY:q )
echo "<$ARRAY>"
--
While testing I saw a(nother) tcsh bug: * and ? cannot be escaped in the =~ and !~ operators.
if ( x =~ ? ) echo true
if ( x =~ "?" ) echo true
if ( x =~ \? ) echo true
Only the first one should say true.
The bug is in tcsh 6.14 until the current 6.18 (not in 6.13 and earlier).