I wrote:
> I don't see how this can be fixed in unix without breaking umpteen million
> shell scripts.

On Sun, Oct 04, 2009 at 06:12:15AM +0200, lu...@proxima.alt.za wrote:
> By creating new commands with distinct new names.

I thought of a better way.  We can fix the commands without breaking
compatibility, using `--'.  `--' in unix normally excludes further options.
My idea is that `--' should force multi-file mode, excluding different
behaviour in case of an empty list or a single-member list.

  `--' ends options, forces consistent multi-file mode, allows empty lists

This gives the best of both worlds - existing usage is still valid, but people
can choose to use new syntax when dealing with lists of files.
It is consistent with the current meaning of `--' in unix.

Examples of new usage (using rc this time):

  # wrap stdin with a header and footer
  cat header - footer

  fn find { du -a $* | awk '{print $2}' }    # du/find are not fixed yet

  # cat all C files, ok if none
  cat -- `{find . | grep '\.c$'}

  # same thing, with grep instead, always outputs file:matching-line
  grep malloc -- `{find . | grep '\.c$'}

Down with DWIM!!

What do you think of this proposal?
Can you think of a real example where it would be incompatible?


Sam


Reply via email to