鱼:如何做会员测试?

fish: how to do a membership test?

我正在尝试编写一个函数来同时启动我所有的流浪机器。我想排除特定的 ID。如何查看 fish 的会员资格?

function test_me
        # this this the array to check against
        set exclude "0a964df" "6a8ab7b" "ebe9620"
        set test (vagrant global-status | grep stop | cut -c1-7);
        for entry in $test
            # if $entry in $exclude - how do I do this?
            vagrant up $entry --no-provision;
        end
end

您需要 contains 命令。

for entry in $test
    if not contains $entry $exclude
        vagrant up $entry --no-provision
    end
end