3 ms·
seq is “less known”? I’d assume anyone familiar with shell scripting would know about it. It’s a great starting point for entertaining children on a terminal:
by koolba 3y ago
seq is “less known”? I’d assume anyone familiar with shell scripting would know about it.
It’s a great starting point for entertaining children on a terminal:
seq 99 -1 0 | xargs printf ‘%s bottles of beer on the wall…\n’
- foobarian 3y agoBash kinda broke seq for me since you can just write {99..0}
- o11c 3y agoOr if you need dynamic arguments, you probably want: N=9; for ((i=0; i<=N; ++i)); do echo "$i"; done
- andrewshadura 3y agoWhy use this form of for when you can just use seq and it works in any shell including fish?
- o11c 3y agoBecause capturing the output of `seq` requires spawning a whole separate process (significant for small sequences) and shoving all the data into a single buffer (significant for large sequences) rather than working incrementally.
- bloopernova 3y agoLess known maybe for most people who read HN, but you're right that a lot of shell scripting folks would know about it.