Start all of your commands with a comma (2009)
21–30 of 130 posts
Re: Start all of your commands with a comma (2009)
#22If I unknowingly named my command the same as some system command and the custom command ends up earlier in my path it doesn't really cause any problems does it? I wasn't using that system command anyways, and my custom command is only going to take priority if my .bashrc file was run first.
It can if you are executing programs that then try to execute those commands and get your commands instead.
Re: Start all of your commands with a comma (2009)
#23Re: Start all of your commands with a comma (2009)
#24Re: Start all of your commands with a comma (2009)
#25Re: Start all of your commands with a comma (2009)
#26This 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)
Is this comment from a bot? You just reiterated everything from the article.
Re: Start all of your commands with a comma (2009)
#27Quoted post unavailable.
Could you please review the site guidelines at https://news.ycombinator.com/newsguidelines.html and stick to them? Your last sentence there breaks more than one of the rules.
Re: Start all of your commands with a comma (2009)
#28If I unknowingly named my command the same as some system command and the custom command ends up earlier in my path it doesn't really cause any problems does it? I wasn't using that system command anyways, and my custom command is only going to take priority if my .bashrc file was run first.
Yes, all of that. And if you later decide to start using the system command, you just rename your custom command.
``` cp () { rsync -avhW --progress --inplace ${@} } ```
If I ever need to use the `cp` binary, I execute `=cp`, which evaluates to `/bin/cp`.
Re: Start all of your commands with a comma (2009)
#29I tend to give programs longer, more descriptive names and then do the short names as shell aliases. That way there’s little risk of name collision for the original program, scripts using the canonical name remain readable, and the shorthand is free to evolve to fit varying work habits.
Re: Start all of your commands with a comma (2009)
#30Is it secure to have ~/bin/ it the PATH?