Live data from Hacker News

Start all of your commands with a comma (2009)

rhodesmill.org

91–100 of 130 posts

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

#92

I have used a similar windows trick. I wanted to add to the default window system a place for my library of tools. Most are "portable" cmd apps from various sources (sysinternals, nirsoft). I put them all into a directory called ] in the root of a drive. Because of some common layout of keyboards the \ and ] are near each other, or in reach of left and right pinkies I can type \]\ before the name of the tools. This m…

Unrelated but I heard it's possible to rename c:\ to /usr/bin or something, depending on your usage. I personally wouldn't mind renaming it to ~/ and be able to use some of my dotfiles in Windows.

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

#94
post #13
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)

Is this comment from a bot? You just reiterated everything from the article.

Related to GP, here's an interesting article: https://rhodesmill.org/brandon/2009/commands-with-comma/

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

#95
post #62

I do something a bit special... Instead of naming my script foobarnator (and hence risking that another foobarnator may exist in the future and may clash with my script), I name my script foobarnatorToBeAliased.sh . Then in my list of aliases I alias foobarnator to foobarnatorToBeAliased.sh . The alias itself looks a bit weird in that to pass arguments to an aliased command you need to use a function (in Bash at leas…

Porque no los dos? It seems that function ,foo() { printf "Fooo\n"; } ,foo actually works! (at least in my bash 5.0.17 shell)

I know this is unimportant, but the phrase is "¿Por qué no los dos?".

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

#96
I started creating wrapper-scripts or simple scripts that has the commands with my prefered options or a selection menu for said command. I have started calling those scripts my

rsync becomes myrsync mount becomes mymount ssh becoms myssh

No collision and the naming convention empathise that it is indeed used be MYself.

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

#97
post #72
post #65

Earlier quoted context omitted.

Two phone sized screenfuls of text is too long now? I'm genuinely interested to know whether you read longform text at all.

I mostly read books. I don't want to pick on the author, but since you asked I will be more specific: this idea would fit in a tweet.* It's a good idea, but the long build up reminds me of recipe sites. * I just use "tweet" as a unit of measure, like "the size of two elephants". I do not advocate the use of twitter.

twitter was still fairly new when this was published and only allowed 140 chars which definitely isn't enough.

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

#98

I have used a similar windows trick. I wanted to add to the default window system a place for my library of tools. Most are "portable" cmd apps from various sources (sysinternals, nirsoft). I put them all into a directory called ] in the root of a drive. Because of some common layout of keyboards the \ and ] are near each other, or in reach of left and right pinkies I can type \]\ before the name of the tools. This m…

Unrelated but I heard it's possible to rename c:\ to /usr/bin or something, depending on your usage. I personally wouldn't mind renaming it to ~/ and be able to use some of my dotfiles in Windows.

It's possible, but 90% of software will break because of this lol

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

#99
In Zsh, you can used named "directories" (actually it works with normal files too) with tildes for the same effect, except that they must be explicitly defined, so there's no risk of collisions.

    hash -d e=/bin/echo
    ~e hello world
https://ato.pxeger.com/run?1=m724qjhjwYKlpSVpuhY3lTMSizMUdFM...

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

#100
post #39
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

Plan 9 does that, I'm not sure why it never made it into Unix because I always loved it. Your networking-related commands were in `/bin/ip` and you'd run e.g. `ip/ping 1.1.1.1`. If you created the dir `$home/bin/rc/my` and put scripts in it, they would have been runnable as `my/hello` etc like in your example.

I've tested it and it works on Linux (bash and zsh), at least for your custom commands
Post reply on HN