Comment by teo_zero

1 year ago

Please note that 'each' is fundamentally different from 'xargs'.

  echo 1 2 3 | each "rm {}"

is the same as

  rm 1
  rm 2
  rm 3

while

  echo 1 2 3 | xargs rm

is the same as

  rm 1 2 3

I would rather say that 'each' replaces (certain uses of) 'for':

  for i in 1 2 3; do rm $i; done

It's equivalent to xargs -I {} rm {}

       -I replace-str
              Replace occurrences of replace-str in the initial-arguments
              with names read from standard input.  Also, unquoted blanks
              do not terminate input items; instead the separator is the
              newline character.  Implies -x and -L 1.