It's certainly no bad habit to handle spaces in scripts preemptively, and obviously they do occur in the wild. Quotes from ls output do not get piped to other commands. I had to look that up myself right now, because it has been quite a while since it mattered to me.
$ touch 'file with spaces in name'
$ ls
'file with spaces in name'
$ ls | cat
file with spaces in name
$
Looking through some scripts I wrote back in the day, I seem to like to use ls -1
in scripts. I guess that reduces ambiguity on what the separator is.
Repeating false statements doesn't make them true. fyi: that's a criticism of your comments ;-)
Feel free to travel back in time and have a discussion with Ken Thompson in ~1970, whether spaces in file/folder names should be allowed in the first place. I for one use an underscore instead, whenever I have control.
It's really neither a bug nor a problem. It is very reasonable default behavior to enable piping to or parsing by other commands because space is the default separator for arguments.
Add-on: you really don't need to get rid of the quotes. It's a very reasonable behavior. You just need to learn/understand what they mean.
The backslash escapes the space because it would otherwise denote a seperator to the next argument of the command. ls a b c
means invoke ls with the three arguments a,b, and c. ls 'a b c'
or ls a\ b\ c
means invoke ls with one argument "a b c". That behavior is universal for pretty much all unix/linux shells (ie bash).
I'd wager a guess, that all file/folder paths that are surrounded by quotes contain at least one space!? And you're talking about the output of ls? It's rather unlikely, that installing any software has changed that behavior. It's just a display feature, to denote that "two" parts separated by a space are actually one.
The ship/mind name with the most emotional attachment is bound to be Bora Horza Gobuchul, though. Oh boy, that book was a rollercoaster!
@_cnt0
@lemmy.villa-straylight.social