Let's said
for i in {1..9}
do
if test $i -ne 8
then
echo $i
fi
done
If there a way to skip number 8 from this sequence {1..9}
without doing the comparison?
PS: GNU bash, version 3.00开发者_如何学JAVA
damn... figure it out myself
for i in {1..7} 9
You can safely do:
{1..N} {N+2..P}
just test if it's the value(s) you don't want and then continue which just finishes this iteration and goes on to the next one.
if $test == 8{
continue;
}
精彩评论