Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

So. Thought experiment.

Which has lower cognitive load if everyone starts doing it?

Explicitly specifying switches, or argv magic? I'd argue, the switches are. In the abscence of the symlinking, that is how the tool functionality would have to be driven anyway.

Argv magic now runs into a problem if another program sharing the name ever comes into existence on the path. It's also completely unergonomic in a sense, because short of looking at the source, you have no way of knowing what argv transforms implementations support are, and in order to use them, you must explicitly pollute the Symbol namespace with a denormalized util. Also, the argv magic does require one extra shell to do the transform from !grep to grep -!, Which is technically more overhead. On the other hand, fgrep and egrep are ironically easier to grep/sed for as opposed to grep/ -[F|E]

One tool, one manual, one name, one argv0.

I am not the Grand Poobah of the Internet, however, even if their hat is in my possession, so I understand that it is likely that the fgrep/egrep convention is probably deeply entrenched, and likely to spawn a new holy war on par with Emacs/Vim. Tabs/spaces, etc...



I don't think grep does any argv-stuff; I took a quick look and I don't see it.

As far as I can tell this is the entire maintenance burden:

  $ cat =egrep =fgrep
  #!/bin/sh
  exec grep -E "$@"
  #!/bin/sh
  exec grep -F "$@"


what shell does this?


Apparently zsh replaces =cmd with cmd's absolute path. TIL.


Yes, very useful to bypass aliases if need be, quickly edit a script ("vi =my-script"), etc. I don't think bash has it; you need to use where/whence/which/command/whatever (I can never remember, why are there so many?!)


Hack: \command instead of command is very unlikely to be aliased, so should work fine.


This is a very useful hack, thanks. Unfortunately, my defensive scripting instincts do not allow me to use it on the "serious" situations.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: