LoginSignup
6
5

More than 5 years have passed since last update.

Bashのブレース展開で00:00から23:59まで

Last updated at Posted at 2013-05-21
$ ( for TIME in {{0..1}{0..9},2{0..3}}:{0..5}{0..9}; do echo $TIME; done; )
00:00
00:01
00:02
(中略)
23:57
23:58
23:59

内容と関係ないんだけど、変数使ってシェル芸キメる時に全体を括弧でくくらないとなんか気持ち悪いのって自分だけ?

2015/04/23追記

↓ブレース展開でゼロパディングできる環境なら

$ echo {00..23}:{00..59} |xargs -n1
6
5
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
6
5