Re: Long filenames in DOS/Windows and Unix/Linux

Liste des GroupesRevenir à cu programmer 
Sujet : Re: Long filenames in DOS/Windows and Unix/Linux
De : invalid (at) *nospam* invalid.invalid (Richard Kettlewell)
Groupes : comp.unix.programmer
Date : 04. Sep 2024, 18:03:27
Autres entêtes
Organisation : terraraq NNTP server
Message-ID : <wwvcylj73mo.fsf@LkoBDZeT.terraraq.uk>
References : 1 2 3 4 5 6 7 8 9 10 11 12
User-Agent : Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
Spaces in file names are likely not to be an issue if you interact
with the filesystem via a GUI like Windows Explorer *or* if you use
a scripting language like Perl or Python that requires strings used
as filenames to be enclosed in quotation marks.  In those contexts,
space is just another character.
 
It can be a real issue if you're interacting via shell commands.
If I happen to know that none of the files I'm working with have
spaces (or other problematic characters) in their names, a lot of
things become easier -- but risky if there's a funny character I'm
not aware of.  For example, I might type something like:
>
    for file in * ; do cp -p $file $file.bak ; done

That’s the heart of the matter. Field splitting happens after parameter
expansion. The languages that don’t have trouble with spaces in
filenames[1] don’t do it that way. I suspect if some different design
decisions had been made long ago, nobody would be inferring from the
difficulties shell scripts have handling strings with spaces in that
they were unnecessary or even forbidden in filenames.

[1] or any other kind of string. Let’s not get tunnel vision about
    filenames: shell has trouble with spaces in other contexts too.

Tcl is the most instructive example: it has a similar word-base
structure to shell, but largely without getting into the same tangles
over spaces.

It would be ideal, I suppose, if interactive shells dealt better with
spaces in file names, but I'm not sure how that could be achieved.  In
current shells, removing two files named "foo" and "bar" is easy, and
removing a single file named "foo bar" requires some extra effort.  I
find that to be a good tradeoff.

Agreed. I note that tab completion normally adds any quotes needed,
which deals with most of the issues in interactive mode, for me.

As well as the above observations about shell syntax we could also
wonder whether it was ever really necessary to use the same syntax both
for interactive file management and a programming language.

--
https://www.greenend.org.uk/rjk/

Date Sujet#  Auteur
31 Aug 24 * Long filenames in DOS/Windows and Unix/Linux (Was: Piping to stdin)61Kenny McCormack
31 Aug 24 +* Re: Long filenames in DOS/Windows and Unix/Linux11Richard Kettlewell
31 Aug 24 i+- Re: Long filenames in DOS/Windows and Unix/Linux1Muttley
1 Sep 24 i`* Re: Long filenames in DOS/Windows and Unix/Linux9Lawrence D'Oliveiro
1 Sep 24 i +* Re: Long filenames in DOS/Windows and Unix/Linux7Lawrence D'Oliveiro
1 Sep 24 i i+- Re: Long filenames in DOS/Windows and Unix/Linux1Nuno Silva
1 Sep 24 i i+- Re: Long filenames in DOS/Windows and Unix/Linux1Helmut Waitzmann
1 Sep 24 i i+- Putting arbitrary characters into the shell command line (was: Long filenames in DOS/Windows and Unix/Linux)1Helmut Waitzmann
3 Sep 24 i i+* Re: Long filenames in DOS/Windows and Unix/Linux2Wayne
3 Sep 24 i ii`- Re: Long filenames in DOS/Windows and Unix/Linux1Lawrence D'Oliveiro
8 Sep 24 i i`- Re: Long filenames in DOS/Windows and Unix/Linux1Janis Papanagnou
1 Sep 24 i `- Arbitrary characters in filenames (was: Long filenames in DOS/Windows and Unix/Linux)1Helmut Waitzmann
31 Aug 24 +* Re: Long filenames in DOS/Windows and Unix/Linux (Was: Piping to stdin)48Muttley
3 Sep 24 i`* Re: Long filenames in DOS/Windows and Unix/Linux (Was: Piping to stdin)47John Ames
3 Sep 24 i +- Re: Long filenames in DOS/Windows and Unix/Linux (Was: Piping to stdin)1Lew Pitcher
3 Sep 24 i +* Re: Long filenames in DOS/Windows and Unix/Linux (Was: Piping to stdin)4Kenny McCormack
4 Sep 24 i i`* Re: Long filenames in DOS/Windows and Unix/Linux (Was: Piping to3Muttley
4 Sep 24 i i `* User surveys (Was: Long filenames in DOS/Windows and Unix/Linux (Was: Piping to)2Kenny McCormack
4 Sep 24 i i  `- Re: User surveys (Was: Long filenames in DOS/Windows and Unix/Linux (Was: Piping to)1Muttley
3 Sep 24 i +* Re: Long filenames in DOS/Windows and Unix/Linux (Was: Piping to stdin)40Kaz Kylheku
3 Sep 24 i i`* Re: Long filenames in DOS/Windows and Unix/Linux (Was: Piping to stdin)39John Ames
3 Sep 24 i i +* Re: Long filenames in DOS/Windows and Unix/Linux (Was: Piping to stdin)37Kaz Kylheku
3 Sep 24 i i i`* Re: Long filenames in DOS/Windows and Unix/Linux (Was: Piping to stdin)36John Ames
3 Sep 24 i i i +- Re: Long filenames in DOS/Windows and Unix/Linux (Was: Piping to stdin)1Lawrence D'Oliveiro
3 Sep 24 i i i `* Re: Long filenames in DOS/Windows and Unix/Linux34Keith Thompson
3 Sep 24 i i i  +* Re: Long filenames in DOS/Windows and Unix/Linux16Lawrence D'Oliveiro
4 Sep 24 i i i  i`* Re: Long filenames in DOS/Windows and Unix/Linux15Keith Thompson
4 Sep 24 i i i  i +* Re: Long filenames in DOS/Windows and Unix/Linux13Lawrence D'Oliveiro
4 Sep 24 i i i  i i+* Re: Long filenames in DOS/Windows and Unix/Linux4Keith Thompson
4 Sep 24 i i i  i ii`* Re: Long filenames in DOS/Windows and Unix/Linux3Lawrence D'Oliveiro
4 Sep 24 i i i  i ii `* Re: Long filenames in DOS/Windows and Unix/Linux2Keith Thompson
4 Sep 24 i i i  i ii  `- Re: Long filenames in DOS/Windows and Unix/Linux1Lawrence D'Oliveiro
4 Sep 24 i i i  i i`* Re: Long filenames in DOS/Windows and Unix/Linux8Ralf Fassel
4 Sep 24 i i i  i i `* Re: Long filenames in DOS/Windows and Unix/Linux7Keith Thompson
4 Sep 24 i i i  i i  `* Re: Long filenames in DOS/Windows and Unix/Linux6Nuno Silva
4 Sep 24 i i i  i i   `* Always use "--" (Was: Long filenames in DOS/Windows and Unix/Linux)5Kenny McCormack
4 Sep 24 i i i  i i    `* Re: Always use "--" (Was: Long filenames in DOS/Windows and Unix/Linux)4Lew Pitcher
4 Sep 24 i i i  i i     +- Re: Always use "--" (Was: Long filenames in DOS/Windows and Unix/Linux)1Lawrence D'Oliveiro
5 Sep 24 i i i  i i     `* Re: Always use "--" (Was: Long filenames in DOS/Windows and Unix/Linux)2Kaz Kylheku
5 Sep 24 i i i  i i      `- Re: Always use "--" (Was: Long filenames in DOS/Windows and Unix/Linux)1Lew Pitcher
4 Sep 24 i i i  i `- Re: Long filenames in DOS/Windows and Unix/Linux1Tim Rentsch
4 Sep 24 i i i  +* Re: Long filenames in DOS/Windows and Unix/Linux11Kaz Kylheku
4 Sep 24 i i i  i+* Re: Long filenames in DOS/Windows and Unix/Linux8Keith Thompson
4 Sep 24 i i i  ii`* Re: Long filenames in DOS/Windows and Unix/Linux7Lawrence D'Oliveiro
4 Sep 24 i i i  ii `* Re: Long filenames in DOS/Windows and Unix/Linux6Keith Thompson
4 Sep 24 i i i  ii  +* Re: Long filenames in DOS/Windows and Unix/Linux4Lawrence D'Oliveiro
4 Sep 24 i i i  ii  i`* Re: Long filenames in DOS/Windows and Unix/Linux3Keith Thompson
4 Sep 24 i i i  ii  i +- Re: Long filenames in DOS/Windows and Unix/Linux1Lawrence D'Oliveiro
4 Sep 24 i i i  ii  i `- Re: Long filenames in DOS/Windows and Unix/Linux1Nuno Silva
4 Sep 24 i i i  ii  `- Re: Long filenames in DOS/Windows and Unix/Linux1Kaz Kylheku
4 Sep 24 i i i  i`* Re: Long filenames in DOS/Windows and Unix/Linux2John Ames
4 Sep 24 i i i  i `- Re: Long filenames in DOS/Windows and Unix/Linux1Muttley
4 Sep 24 i i i  `* Re: Long filenames in DOS/Windows and Unix/Linux6Richard Kettlewell
5 Sep 24 i i i   `* Re: Long filenames in DOS/Windows and Unix/Linux5Ralf Fassel
5 Sep 24 i i i    +* Re: Long filenames in DOS/Windows and Unix/Linux3Richard Kettlewell
7 Sep 24 i i i    i`* Re: Long filenames in DOS/Windows and Unix/Linux2candycanearter07
7 Sep 24 i i i    i `- Word splitting oddities (Was: Long filenames in DOS/Windows and Unix/Linux)1Kenny McCormack
10 Sep 24 i i i    `- Re: Long filenames in DOS/Windows and Unix/Linux1Janis Papanagnou
10 Sep 24 i i `- Re: Long filenames in DOS/Windows and Unix/Linux (Was: Piping to stdin)1Janis Papanagnou
4 Sep 24 i `- Re: Long filenames in DOS/Windows and Unix/Linux (Was: Piping to1Muttley
1 Sep 24 `- Re: Long filenames in DOS/Windows and Unix/Linux (Was: Piping to stdin)1Marcel Mueller

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal