Very often, when using the command line or just programming, you want to express some kind of combination that you end up using a for
- which is often verbose.
for (int i = 0; i<10; ++i)
std::cout << "img_" << i << std::endl;
for f in *; do echo "$f"; done
I always wondered if there is some kind of language made to simplify this case? For example:
"mv img_[0~6] imgs"
Would translate to
mv img_0 imgs
mv img_1 imgs
mv img_2 imgs
mv img_3 imgs
mv img_4 imgs
mv img_5 imgs
img_[0~1][0~1]
could work for img_00, img_01, img_10, img_11
img_[x:0~2][x]
could work for img_00, img_11, img_22
Etc.
I'm not asking for this particular syntax, just if there is any kind of language/feature ever implemented with the purpose of expressing such combinations as easy as possible?