3 ms·
Well, using Bash. A lot of these tricks aren't portable so you'll have fun when your scripts break on e.g. Dash (Ubuntu).
by mehrdadn 7y ago
Well, using Bash. A lot of these tricks aren't portable so you'll have fun when your scripts break on e.g. Dash (Ubuntu).
- jraph 7y agoAlso works on zsh and fish, though fish does not enumerate in the same order. Indeed does not work on sh. Thanks for the heads up. Too bad it's not portable, but I guess this is mainly useful in an interactive shell. I mostly use #!/usr/bin/env sh, so my scripts will remain free of shell Cartesian products and other brace expansions.