Live data from Hacker News

Start all of your commands with a comma (2009)

rhodesmill.org

131–140 of 177 posts

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

#131

> The lower-case letters are the very characters used in system commands; brackets, backslashes, the colon, the back-tick, and the single-tick all had a special meaning to the shell Please note that brackets have no special meaning to the shell.

Cunningham's Law in action lol

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

#132

I dislike this immensely. It costs nothing to type "~/bin" in front of the command each and every time. And it means I can put comma's wherever I want in some commands that use them, like SQL .. I do, however, like to comment my custom commands: $ mv ~/Desktop/*pdf ~/Documents/PDF # pdfsync $ for i in ~/Documents/Development/JUCE/JUCE_Projects/* ; do ; cowsay $i ; cd $i ; git pull ; git fetch --all ; git submodule up…

You can do what you want but it’s not nothing: it costs six keystrokes every time (seven, counting shift for tilde)

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

#134
post #126

> Because my shell script names tended to be short and pithy collections of lowercase characters, just like the default system commands, there was no telling when Linux would add a new command that would happen to have the same name as one of mine. Not sure I understand this problem. I just put my bin directory at the front of $PATH rather than the end. To browse my commands, I simply `ls ~/bin`.

I just… remember the names I give things? Why is this considered a “hack” of some kind?

It may not be useful to you, but it seems a bit too much to then jump to the conclusion it must be useless for everyone.

I forget names all the time. I even forget I wrote entire projects sometimes. That's why I try to organise my systems in a way I can easily stumble upon things I haven't thought about in months, or years.

I find this article's approach actually solves a problem for me. I do find myself going back to the ~/bin folder once I a while to look for some script I use less often. So at least for N=2, it's a cool hack.

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

#137
post #19

> Because my shell script names tended to be short and pithy collections of lowercase characters, just like the default system commands, there was no telling when Linux would add a new command that would happen to have the same name as one of mine. Not sure I understand this problem. I just put my bin directory at the front of $PATH rather than the end. To browse my commands, I simply `ls ~/bin`.

But then you start using some tool that expects $0 in the system path and breaks causing frustration and debugging. Pick your poison

What is "system path"? Every tool inherits the caller's path. I don't think this could be a problem unless a tool talked directly to systemd to execute itself.

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

#138

No thank you. Put your personal bin first in PATH, and use /usr/bin or /bin for referring to the shadowed programs. You can list your personalized tooling using ~/bin/[Tab] for whatever value there is in that.

I don't understand why you would shadow the system utilities with your own, yet not want to use identical names, so that you have to keep remembering to use the comma.

If you don't like the system's grep (e.g. Solaris grep or whatever) but prefer your own (e.g. GNU grep), why wouldn't you just want that to be "grep".

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

#140

An alternative method for avoiding collisions in PATH is to use really long executable names that are unlikely to be used by other executables and then have shorter aliases for them in your bashrc. The aliases won't affect executables called from within scripts and you can still refer to your executables by their long names in your own scripts. One drawback is that this doesn't have the same tab completion ergonomics…

> One drawback is that this doesn't have the same tab completion ergonomics, which I have to admit is really nifty. They do in zsh

I meant specifically that you can quickly see all your custom scripts (and only them) by tab-completing comma itself. Of course aliases have regular tab completion in bash as well.
Post reply on HN