![bash for 循环多个数字范围](https://linux22.com/image/154752/bash%20for%20%E5%BE%AA%E7%8E%AF%E5%A4%9A%E4%B8%AA%E6%95%B0%E5%AD%97%E8%8C%83%E5%9B%B4.png)
我想运行 bash 数字“for”循环,但我想跳过中间的一些数字。
例子:
for num in {1..4, 7..11, 23..34}; do (echo num $num); done
或者
for num in {17..24, 41..48}; do (echo num $num); done
- 这可能吗?
- 如何?
答案1
for num in {17..24} {41..48}; do (echo num $num); done
,并查看文档支撑扩张在bash中。