Hacker News new | ask | show | jobs
by jzzskijj 2437 days ago
This got me to raise an eyebrow:

    if [[ -d "$HOME/dev/go" ]]; then
        export GOPATH="$HOME/dev/go"
    fi
Using a directory named "dev" not to store device files, but development tools. I am so stuck with conventions.
4 comments

True! Also the mixing of upper and lower-case directories on ~ is a red flag.

Offtopic, but this kind of one-line conditions are typically best written as

    test -d ~/dev/go && export GOPATH=~/dev/go
then it is easier tho change the sign of the condition (by using either || or &&)
File systems on macOS are case insensitive. The system-provided directories are capitalized by convention, but you may also refer to them in lowercase if you like. It’s no more a “red flag” than `c:\WINDOWS` being capitalized.

I opt for the if-brackets rather than the one line syntax because it is clearer to read. “if this, then that” is less mental effort than remembering just how boolean operators short circuit, for me at least. It's a few extra lines but I prefer the layout, indent, and ease of scanning.

Windows now has optional case sensitivity on a per directory level. Drove me crazy trying to work out errors in an old c# codebase after a git checkout in wsl, multiple rounds of screaming THE FILES RIGHT THERE!
> File systems on macOS are case insensitive.

Not all of them. You can choose to have a case-sensitive filesystem if you’d like.

As of about five years ago, enabling that feature at mkfs time broke tons of apps that assume case insensitivity. Not sure if the situation has improved.
Speaking of filename weirdness.. I changed my Mac's language to Spanish a few years ago, as I was learning the language, which has many bizarre effects, online and off. One is that the Library folder in my home folder appears in Finder as Librería, yet if I try to cd to Librería or Libreria in bash it doesn't work, as it's actually Library. Same for Documentos, Imágenes, Aplicaciones, Escritorio (Desktop), Usuarios, Sistema etc. I haven't looked into how that actually works. But there seems something very wrong about files appearing as not what they're called, which I assume the whole non-English-speaking world puts up with.
> File systems on macOS are case insensitive.

Holy smacks, all these years and I never knew that! Too bad auto-complete doesn't pick up on it though.

It can. Try: set completion-ignore-case on (for bash).
A "red flag" for what? He's using macOS, in which the typical user-facing directories are propercase (/Users, ~/Documents, etc.)
I don't know, it's just very ugly and it lacks a sense of aesthetics (just like everything else on macos, so at least it is consistent).

It's like reading a book that uses three different fonts on each page. You just cannot take it seriously.

Aren't you being a little over-dramatic? I use Uppercase directories (Documents, Downloads, Development) in my ~ as well, in a consistent manner. Why is that ugly?
I dislike CaMelcAse as well, but to each his own, I have stuff backed up from my windows machine on my BSD machine that has spaces and uppercase i leave it in case i need to restore. It does not mean you cannot take it seriously.

MacOS is one of the few registered UNIX systems out there (https://en.wikipedia.org/wiki/Single_UNIX_Specification#macO...).

I actually do not own a Mac, but it is a decent OS and performs well and tries to be windows friendly (hence camelcase and spaces) and tries to be stable and secure.

I guess the downvotes tell you how other hackers feel about your opinions.
letter cases were a mistake in language itself.

cool way to bloat your glyph set to double the size and introduce aesthetic and string matching problems.

Related fact: the term "case" dates back to the old printing presses where characters would be individual blocks or wood or metal and they were stored in draws. Capital letters were stored in the draw above non-capital letters -- hence why they are referred to as "upper case" and "lower case".

In terms of your general point, upper and lower case letters were originally different stylistic type-faces rather than "modes" of a letter in the same type-face. It wasn't until relatively recently in our writing history that the rules of capital letters became defined rather than a style choice and I'm certain they weren't thinking much about the problems that might cause with string matching on digital systems invented several hundred years later.

I justify it to myself as “$HOME is different.” My fingers are also fast at typing it, and my brain is very well adjusted to “I am unprivileged” xor “I am root” - dev means vastly different things in those contexts, just as rm -r does.
Indeed, if it works for you, then it is good.

In 1990's I used to have ~/dev in school's Sparcs running SunOS, as I needed some device files that weren't available in /dev. But I was able to mknod them.

I've been also toying with chroots quite a lot and there dev is also quite essential for its original purpose. Therefore "dev" is like a reserved keyword for me in *nix systems.

Personally I use ~/w (like "work") or ~/code mostly. I've had ~/dev once for storing projects, but I had to rename it as it was distracting (to me) :)

Do you chroot to ~? Do you still use 90s SunOS?

Neither do I.

No. Above I explained to you why my experiences has made me to think "dev" is special. I don't get your reaction.
This is a point of conflict for me. I use "~/dev" for all of my development work, but I don't want to because of the convention set by "/dev".

My problem is finding an alternative to "dev" that is just as convenient. Do any of you have any suggested alternatives?

I've always found myself using `~/projects/` for my development. It's also general enough that I can put not-quite-software projects like this in there: https://github.com/lelandbatey/custom_cpu--ALU
I use ~/ops

...but not in the "operator" sense. Rather, the "operations" sense...and that is because i used to use ~/projects...But i got lazy to type that out.

sometimes I use ~/opt
I Use ~/src for ad-hocs and ~/git to home all of the git projects
Just use ~/dev. It's OK to have two folders with the same name, if they're in different places. This is after all why we have folders in the first place!
I just use ~/Developer - with tab completion it's not really any harder to type. (And on macOS ~/Developer automatically gets a unique icon in Finder)
I usually use "~/repos". That makes "re<tab>" a one hand movement in one direction.

Most everything I do development-wise is in Git, which is why I came to that name years ago.

I also have a "~/tmp" directory for one-off dev stuff that I clean up periodically.

I use ~/code
How about `~/workspace`? With tab and autocomplete it‘s not hard to type.

But I must admit that `~/code` seems a good alternative to me.

This is what I use with the specific nit that I actually only use it for "work stuff" and usually have a `~/personal/` for my own pet projects and a `~/scripts/` for anything that I want on my path.
I use ~/hg with a big monorepo
I use ~/devel
I use ~/lab
i use ~/prog
I don't like it either, but that's an artifact of using macOS - most users aren't fully aware of Linux naming conventions.
It's not a Linux convention, it's a Unix convention.
macOS also uses /dev for device nodes.