Skip to main content
3 of 5
added 199 characters in body
user avatar
user avatar
if (" $shortROI " =~ *" $argv[$ac] "*)
   ...
endif

Example:

set list = (foo bar baz)

foreach a ($*)
        if(" $list " =~ *" $a "*) then
                echo "$a in list"
        else
                echo "$a NOT in list"
        endif
end

This may incorrectly return true if either the variable on the right side or any of the words from the list contain spaces. If you can decide on a character which cannot appear in either side (eg. @), you can replace the spaces with it in each word:

        if(" $list:q:gas/ /@/ " =~ *" $a:q:as/ /@/ "*) then
user313992