Live data from Hacker News

I'm “still afraid to use spaces in file names” years old

twitter.com

431–440 of 817 posts

Re: I'm “still afraid to use spaces in file names” years old

#431

Earlier quoted context omitted.

Not exactly - the problem is mostly when doing variable expansion. The fact that bash treats "$x" and $x as different is a bit of a design flaw. Of course there's still an issue with evaluating dynamically generated code, but that problem is partly solved by working with arrays.

I mean how do you want shells to deal with file names with spaces in? Do you think we should have to quote and escape all file names all the time? If not then how do you think it should work?

Shells should treat data as data, and not have the default behaviour be treating it as code (i.e. you should need to do 'eval $x' or some equivilant if you acutally want the string to be treated as a shell command). This would also mean having a real list type, instead of depending on arbitrary seperators in strings. This is exactly how other languages treat it, and it is not a significant challenge for interactive use (in fact, it would substantially reduce the opportunity for suprises when running commands interactively as well).

Re: I'm “still afraid to use spaces in file names” years old

#433

Earlier quoted context omitted.

You state that as if that were objective.. but that's not my subjective experience at all. Somehow I have a hard time remembering these long names, (is it --conf or --config or --config-file or --config-path? -c would've done it for me. --set or --set-prop or --set-property or --prop or --property?), and I need to look them up in a man page anyway, and I make more typos typing them, and shell completion rarely works…

I'm with you. Terseness is paramount. I could never overcome my repulsion for Java and ObjC because of that. On the other hand, I fell at home with crazy RegEx that look like line noise to most people.

I think shells could use something like a built-in eldoc[1], in addition to tab completion. It would make terse command line interfaces much more usable if you could see what the positional arguments were for.

[1]: https://docs.cider.mx/cider/config/eldoc.html

Re: I'm “still afraid to use spaces in file names” years old

#434

Earlier quoted context omitted.

> FWIW, and it should be food for thought, every single Git repository in the world contains a pre-commit hook sample (disabled by default but it's there) that enforces that every committed file in the repo is named using a subset of ASCII characters. I use Git for documents too, not only code. Why shouldn't I use my native language?

Tab completion don’t work well for languages that require IME. That is one reason why I don’t.

That's actually a good point. On the other hand, not all languages use IMEs. Mine just uses the AltGr modifier key, but is otherwise just a standard QWERTY layout without any features.

Re: I'm “still afraid to use spaces in file names” years old

#435
post #411

I have an overly-aggressive function in my .bashrc to rename all files in the current directory: # Rename all files in a directory rn() { rename "s/ /-/g" * rename "s/_/-/g" * rename "s/–/-/g" * rename "s/://g" * rename "s/\(//g" * rename "s/\)//g" * rename "s/\[//g" * rename "s/\]//g" * rename 's/"//g' * rename "s/'//g" * rename "s/,//g" * rename "y/A-Z/a-z/" * rename "s/---/--/g" * rename "s/-‎--/--/g" * } I use th…

Overly aggresive is right! I don't know if this is genius or deranged! I'm leaning towards genius and stealing the idea.

By the way: what's your beef with en dashes? I mean, if it was "everything should be 'HYPHEN-MINUS' (U+002D)", then fine, but why specifically en dashes and not em dashes?

Re: I'm “still afraid to use spaces in file names” years old

#436
And I'm older than Google. If you want some hilarity, newlines are allowed in filenames as well (\n, \r, \r\n). Try getting bash to handle that! (It's possible, though annoying. try redirecting to `while read line` in addition to xargs -print0 hackery)

Re: I'm “still afraid to use spaces in file names” years old

#437
post #214

Earlier quoted context omitted.

GoboLinux does exactly that: https://en.m.wikipedia.org/wiki/GoboLinux

Wow, thanks for the reply, nice find! I did some poking around on my Linux system and even re-arranging the home folder was a task of its own because the system kept trying to replace folders in their original places. I will do some digging in to Gobo and see how they're handling this. Thanks again for pointing this out.

You’re clearly a more capable user than me, but even so, take care. The time I accidentally moved /etc has scarred me for life.

Re: I'm “still afraid to use spaces in file names” years old

#438
post #235

Earlier quoted context omitted.

I see and applaud your use of the underscore there, but I must reject the premise! work/client/project/2021-11-11-file.ext is more or less how I lay stuff out. I’d say client/project is a folder level distinction (arguably dates too). [EDIT] Realistically most of the stuff under is git repos and I usually make a “home” repo where I keep org files for tracking hours, notes, and resources related to the engagement.

work/client/project/2021-11-11-file.ext is great until you've got a '2021-11-11-project-status.txt' in a few directories and you need to find one quickly! I do a combination: clients/client/project/2021-11-11-client-project-update.txt

I just store it as a content hash and then when I want to find the file, I just have to recreate its content and I can then just get the hash.

Re: I'm “still afraid to use spaces in file names” years old

#439
post #235

Earlier quoted context omitted.

I see and applaud your use of the underscore there, but I must reject the premise! work/client/project/2021-11-11-file.ext is more or less how I lay stuff out. I’d say client/project is a folder level distinction (arguably dates too). [EDIT] Realistically most of the stuff under is git repos and I usually make a “home” repo where I keep org files for tracking hours, notes, and resources related to the engagement.

work/client/project/2021-11-11-file.ext is great until you've got a '2021-11-11-project-status.txt' in a few directories and you need to find one quickly! I do a combination: clients/client/project/2021-11-11-client-project-update.txt

It sounds like what everyone in this thread needs is a database file system. This was always my favorite proposed feature of Windows Longhorn that never made the cut. Almost 2 decades later and Microsoft's latest OS still doesn't have this feature.

Re: I'm “still afraid to use spaces in file names” years old

#440
post #190

Earlier quoted context omitted.

You know, this makes me wonder.. tangentially speaking- I wonder how hard it would be to rearrange the folder structure in linux so that I have something like this: /Users/{root, user0, user1, ... }... /System/{Logs, Apps/{opt, container, ...}, Temp, Conf ...}... /Devices/{Mount, sda, sdb, null ...}... /Boot/...

You don't even need to rearrange the folders themselves, just show them like that in the file explorer. Same way the windows explorer does.

Do you have any docs on how to do that? Thanks for the reply, I look forward to trying that.
Post reply on HN