Live data from Hacker News

Start all of your commands with a comma (2009)

rhodesmill.org

1–10 of 130 posts

Re: Start all of your commands with a comma (2009)

#2
This is a good trick to avoid collisions with system commands. Anytime you add one of your own executables to PATH, prefix it with a comma (,). This way you avoid name collisions and have a handy way of seeing what commands are available on your system using tab completion (, then tab lists all of your personal executables)

Re: Start all of your commands with a comma (2009)

#3
post #2

This is a good trick to avoid collisions with system commands. Anytime you add one of your own executables to PATH, prefix it with a comma (,). This way you avoid name collisions and have a handy way of seeing what commands are available on your system using tab completion (, then tab lists all of your personal executables)

[deleted]

Re: Start all of your commands with a comma (2009)

#8
Clever trick. Too bad there's no good way to namespace commands. It would be interesting if you could have, for instance:

  $ mkdir -p /tmp/bin/my
  $ printf '%s\n%s\n' '#!/bin/sh' 'echo hello' > /tmp/bin/my/hello
  $ chmod 755 /tmp/bin/my/hello
  $ PATH="/tmp/bin:$PATH"
  $ my/hello
  hello

Re: Start all of your commands with a comma (2009)

#9
I use this method for aliases in my `.*rc` file so I can remember what the heck I called things. Otherwise, I forget whether I have to type something like `COMMANDNAME-log` or `log-COMMANDNAME` or some other weird combo like `print-COMMANDNAME-log`. With a comma, I type `,` and get all of my custom commands listed easily.

Re: Start all of your commands with a comma (2009)

#10
post #8

Clever trick. Too bad there's no good way to namespace commands. It would be interesting if you could have, for instance: $ mkdir -p /tmp/bin/my $ printf '%s\n%s\n' '#!/bin/sh' 'echo hello' > /tmp/bin/my/hello $ chmod 755 /tmp/bin/my/hello $ PATH="/tmp/bin:$PATH" $ my/hello hello

Just add another comma. Of course, this needs some deeper magic to work :)

    ,my,hello
Post reply on HN