Top
Best
New

Posted by theblazehen 2 days ago

Start all of your commands with a comma(rhodesmill.org)
187 points | 54 comments
mathfailure 1 hour ago|
I didn't like the idea. I prefer the alternative approach: _I_ decide the order of dirs in the PATH env. If I introduce an executable with a name, that overrides a system one - I probably do that intentionally.

If I introduce an alias (like `grep='grep --binary-files=without-match --ignore-case --color=auto`) that matches the name of a system binary - I probably do that intentionally.

And if I EVER need to call grep without my alias - I just prefix it with a backslash: \grep will search with case sensitivity and no color and will scan binaries.

mid-kid 49 minutes ago||
Either adding your script directory in front of the PATH, or creating `alias` that provide a full path to your script where a conflict exists, makes a whole lot more sense to me.

I've never had this collision problem yet, despite appending my script directory to the end, but I'll use either of the above solutions if that ever becomes a problem.

alance 15 minutes ago|||
Just on your first suggestion, this also means that if a person or process can drop a file (unknown to you) into your ~/bin/ then they can wreak havoc. Eg they can override `sudo` to capture your password, or override `rm` to send your files somewhere interesting, and so on.

Btw on the second suggestion, I think there's a command named `command` that can help with that sort of thing, avoids recursive pitfalls.

znpy 2 minutes ago||
While true, what you describe is very unlikely to happen and most definitely won’t happens on systems where i’m the only users.
112233 50 minutes ago|||
Any severe side effects so far? Have you set PATH up somehow so it is effect only on interactive prompt, and not in the launched processes?

Because I cannot imagine much 3rd party scripts working with random flags added to core tools

deredede 13 minutes ago||
I also do this.

Random flags added to core tools are done with aliases, which do not affect the launched processes, not by shadowing them in ~/bin. Shadowing in ~/bin are for cases where a newer (compared to the system-wide version) or custom version of a tool is needed.

fragmede 57 minutes ago|||
curious if you're customizing anyway, why not use eg ripgrep?
chrisjj 1 hour ago||
> If I introduce an executable with a name, that overrides a system one

... and breaks existing scripts that reference the system one, right?

amszmidt 20 minutes ago||
Not if it is an alias.
alzee 16 minutes ago||
Using commas in filenames feels kind of weird to me, but I do use a comma as the initiator for my Bash key sequences. For example: ,, expands to $ ,h expands to --help ,v expands to --version ,s prefixes sudo

You put keyseqs in ~/.inputc, set a keyseq-timeout, and it just works.

Tade0 7 minutes ago||
As a non-native English speaker I just name them in my native language or using British English spelling.

I have a command named "decolour", which strips (most) ANSI escape codes. Clear as day what it does, almost nobody uses this spelling when naming commands that later land as part of a distribution.

caeruleus 1 hour ago||
Prefixing commands solves the namespace problem and discoverability (at least partly). I use a slightly more sophisticated method, which helps me remember which custom utilities are available and how to use them: sd [1], a light wrapper written for zsh that, in addition to namespaces, provides autocompletion, custom help texts + some other QoL enhancements. Can definitely recommend if you're looking for something a bit more fancy.

[1] https://github.com/ianthehenry/sd

tomcam 1 hour ago||

    Every tool and shell that lay in arm's reach treated the comma as a perfectly normal and unobjectionable character in a filename.
WTF. After 40 years maybe I should have figured that one out.
pm215 59 minutes ago||
It's not a completely non special character: for instance in bash it's special inside braces in the syntax where "/{,usr/}bin" expands to "/bin /usr/bin". But the need to start that syntax with the open brace will remind you about the need to escape a literal comma there if you ever want one.
mike-the-mikado 11 minutes ago||
Until someone forces you to use a file system that cannot tolerate commas...
ljouhet 1 hour ago||
Most of my aliases contain `--` for the same reason, `git--progress`, `grep--rIn`, `nvidia--kill`, `ollama--restart`, `rsync--cp`, `pdf--nup`...

Easy autocomplete, I know there won't be any collision, and which command is mine.

vitorsr 37 minutes ago||
Nice although I think the ASCII comma feels wrong as part of a filename even if for purely aesthetic reasons.

If we want to stay within (lowercase) alphabetic Latin characters I think prefixing with the least common letters or bigrams that start a word (x, q, y, z, j) is best.

`y' for instance only autocompletes to `yes' and `ypdomainname' on my path.

Choosing a unique bigram is actually quite easy and a fun exercise.

And we can always use uppercase Latin letters since commands very rarely use never mind start with those.

impoppy 58 minutes ago||
Why so many people use ~/bin/? What’s wrong with ~/.local/bin?
1313ed01 37 minutes ago||
Random things are installed in ~/.local/bin. In ~/bin I have only what I put there.
dark-star 50 minutes ago|||
~/bin/ preceeds the XDG Base Directory Specification.

~/.local was only invented around 2003 and gained widespread usage maybe 15 years or so ago...

People used ~/bin already in the 90s ;-)

zhouzhao 53 minutes ago||
Nothing. I also use `~/.local/bin/`
mromanuk 1 hour ago||
It’s clever, but is not aesthetic. A comma feels unnatural in the fs.
mystifyingpoi 53 minutes ago|
It doesn't have to be a literal file, it can be an alias.
More comments...