我想每 1 秒将一个接口上下移动 80 次,我该如何通过 bash 脚本来实现呢?
像这样的东西?
COUNT = 80
for n in $(seq -w 1 $COUNT); do
case $n in
[1,3,5,7,9....79]*) # I don't know how to represent the odd value only
ifconfig veth1 down
sleep 1
;;
[2,4,6,8,10....80]*)
ifconfig veth1 up
sleep 1
;;
esac
done