/usr/bin/env followed by the name of a program executes that program. It looks up the program name as an executable file in the directories configured by the
PATH environment variable. It's a special case of the usage of
env is followed by some environment variable assignments and then a program name and arguments — here there happens to be zero variable assignments.
/usr/bin/env echo … is equivalent to
/bin/echo …, except that it doesn't hard-code the path to
echo — depending on the system and on the value of
PATH, it could be
Almost every shell has an
echo command built in. There may be differences in behavior between the shell builtin and the external command. In practice, there are variations between
echo commands in two respects: what happens if the first argument begins with
- (some versions of
echo process a few options), and how a backslash is processed (some versions print it literally, others treat it as an escape character). So forcing a version of
echo is useful occasionally, when you want to use these implementation-dependent behavior. In most cases it's better to use
printf instead —
printf can do everything that
echo can do, and is portable except to antiques.
With the arguments passed in your sample code, the choice of an echo implementation doesn't matter. If there's a point to this madness, it would require a lot more context to figure out.