12 Matching Annotations
  1. Apr 2025
    1. I use dashes -, for the reasons you mention above. I avoid underscores because they require using the shift key, so take at least twice as long to type (also, I think they're ugly)
    2. With so many characters that you might not think should be special, in fact being special, I just use the special characters anyway. This also puts me in the good habits of using bash completion, where it will auto-escape all the special characters in a filename. But it also puts me in the good habits of escaping/quoting EVERYTHING in scripts and multi-part 1-liners in bash. For example, in just a simple 1-liner: for file in *.txt; do something.sh "$file"; done That way, even if one of the files has a space, or some other character, the do part of the loop will still act on it, and not miss on 2 or more file-name-parts, possibly causing unintended side-effects. Since I cannot control the space/not-space naming of EVERY file I encounter, and if I tried, it would probably break some symlinks somewhere, causing yet more unintended consequences, I just expect that all filename/directoryname could have spaces in it, and just quote/escape all variables to compensate. So, then I just use whatever characters I want (often spaces) in filenames. I even use spaces in ZFS dataset names, which I have to admit has caused a fair amount of head-scratching among the developers that write the software for the NAS I use. Sum-up: Spaces are not an invalid character, so there's no reason not to use them.
    1. I've noticed somethings, particularly ADB commands, use spaces to issue the next part of the command. Thus having a space would say that there's a new command. And since hyphens are actually used in some spelling, such as my last name, it's better to use underscores.
    1. I didn't see this mentioned, but lots of software doesn't treat the underscore as a word separator (also called a "break character") these days. In other words, you can't jump to next word with Ctrl+Right-arrow or select individual words by double-clicking on them. The argument is that variable names in some programming languages like Python use snake_case, so highlighting them might require an extra Ctrl+Right-arrow. I do not necessarily like that decision, because, while being (marginally) useful in those limited domains, it makes file renaming and any other word manipulations or typesetting very cumbersome.
    2. But one thing to remember is that if you are primarily doing python coding - and your code tree has files/directories with hyphen in them and you intend to use them as modules (do an import filename in your code), then this will cause errors as python modules cannot have hyphen in them.
    3. Underscores are usually the convention that people use when replacing spaces, although hyphens are fine too I'd say. But since hyphens might show up in other ways such as hyphenated words, you'll have more success in preserving a name value by using underscores. For instance, if you have a file called "A picture taken in Winston-Salem, NC.jpg" and you want to convert the spaces to underscores, then you can preserve the hyphen in the name and retain its meaning.
    1. I must be the exception, because I use both spaces and underscores, depending on circumstances.   The practical/obsessive-compulsive side of me saves all my documents using spaces. They're cleaner to read than underscores, and they look far more professional.   The programmer side of me still uses underscores in files that will be accessible via the web or that need to be parsed in a program.   And to complicate matters worse, I use camel case to name all my programming files. So in actuality I use 3 standards interchangeably.   Both have their uses, I just choose one for clarity and one for ease of use.
    1. Separating each of these entities with a hyphen allows you to double-click and highlight only that entity. With underscores-only, you need to enlist the painstaking process of precisely positioning your cursor at the beginning of the entity, then dragging your blue selector to the end of the entity.