LoginSignup
2
3

More than 5 years have passed since last update.

BashでN回ループは`for i in {1..N}`でOK

Last updated at Posted at 2017-09-13

Bashで指定回数ループする処理は、for i in {x..y}という書き方がお手軽です。

main.sh
#!/bin/bash
for i in {1..3}
do
    echo $i
done
実行結果
1
2
3
2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3