[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to handle whitespace in filenames ???



On Wed, 19 Dec 2001 16:56:26 -0800
Craig Dickson <crdic@yahoo.com> wrote:

> Michael D. Schleif wrote:
> 
> > How would you like to handle 0x08, 0x0a or 0x0d ???  Remember, we are
> > talking about text handling here, not binaries . . .
> > 
> We can sensibly limit ourselves to printable characters for filenames;
> it's silly to suggest that if you let people use spaces, next they'll
> want control characters.

If they do work or not, this just depends on the underlying
filesystem. If it's an MSDOG (a floppy) your out of luck with more
than 8+3. On ext2, for instance, 

	main () { fopen ("-\a\d\n", "w"); }

in C will work. Don't do that, because with rm(1) you can't delete
this file. But it might be funny to use ls(1) with it, ringing the
bell. (Are there accoustic filenames in user friendly OS?)

> There is a good reason to support spaces if you want your OS to appeal
> to ex-Windows or ex-Mac users, who are used to creating filenames like
> "Letter to Joe.doc" or "Smith Family Budget.xls".

Personally, I'm not very interested in having ex-something feeling
appealed. I just want a consistent operating system. Might it be that
it's mostly recent ex-something users that ask for it?

> Unfortuantely, since spaces in filenames have never been a priority for
> Unix users, most Unix tools behave counter-intuitively (from the
> perspective of someone new to the system) when confronted with such
> things. For example, in Bourne-related shells:
> 
>     A="foo bar"
>     B="baz"
>     for C in $A $B; do
>         echo $C
>     done

Hm. I just wanted to suggest, you open a DOS window in your favorite
OS and try it, but then, this just doesn't work. command.com is too
broken. But, it's good enough to change directory. What about

	cd c:\Program Files

would this work? I'd like to suggest this IS intuitive, is it?
OK. Now, you are going to tell me, that using gmc and StarOffice, you
never have to cd anywhere. And I'll spare you my answer.

Someone already stated that the space is a token separator (in many
computer related contexts, not just limited to unix like OSs, but
including MS-Windows). Also, if you find your for-loop
counter-intuitive, you are demonstrating to use variables without
bearing in mind their meaning. If you find `counter-intuitive' that a
space is a token separator, why did you use it between the tokens?
shouldn't you suggest another character instead?

	for_C_in_$A_$B;_do_echo_$C_done

Now, you'll get the expected result (I've never used it, but I think
to remember that bash does allow to change that). Don't you see that
you are using the space ambiguously?

> If Unix were just being developed today, without thirty years of history
> and backward-compatibility to worry about, I'd submit a bug report for
> things like this. I understand why it works the way it does; I just
> think it was a mistake.

Unfortunately people like those from StarOffice, Gnome, etc. think
like you, that typing commands is anacronic. The difference is not
just that a space is interpreted as a token; it is that ex-something
users are not used to type commands, they _click_ commands. Don't you
think there is a reason that command.com didn't evolve since more than
a decade? But then, the unix shell offers a big deal of the additional
power which you can't get easily on a `luser friendly' system.

--
Christoph Simon
ciccio@kiosknet.com.br
---
^X^C
q
quit
:q
^C
end
x
exit
ZZ
^D
?
help
.



Reply to: