Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
让我们说
for i in {1..9} do if test $i -ne 8 then echo $i fi done
如果有没有办法从这个序列中跳过数字 8{1..9}而不进行比较?
{1..9}
PS: GNU bash,版本 3.00
该死的……自己想办法
for i in {1..7} 9
您可以安全地执行以下操作:
{1..N} {N+2..P}
只需测试它是否是您不想要的值,然后继续完成此迭代并继续下一个迭代。
if $test == 8{ continue; }