Wiki

Clone wiki

foreach / Home

Installation

Build it with make and copy the executable wherever you want it.

I set it up to use clang. If you want to use a different compiler, edit the Makefile.

Usage

foreach <filenames> ':' <command> [arguments] '{}' ';'

The ':' separates the command and its arguments from the input filenames. The '{}' and ';' work as they do in find(1): the '{}' is replaced with each input filename for each job, and the ';' signals the end of the arguments (which is how foreach knows that you entered the command correctly and didn't, say, get the filenames and command backwards).

I use zsh. How do I use this foreach instead of the built-in foreach?

alias foreach='command foreach'

What if I have a file named ':'?

Name your files better.

Updated