Partial glob
Today I wrote the following line:
for f in *.pdf; convert -density 150 $f"[0]" -flatten $filename($f).png; end
This works fine, right? But there's a problem. A file extension can have more than one level (for example, foo.user.js
), so in general case $filename
is not sufficient.
Instead of using ad-hoc functions, it would be nice to have a glob deconstructed into several parts. So you could so something like
for (n, e) in (*).({bmp,gif,png})
convert $n.$e $n.jpg
end
So globing is more like pattern matching.