[tex-live] Comment on Re: TeXLive-CD/DVD (Installation)

Oliver Bandel oliver at first.in-berlin.de
Thu May 24 12:30:50 CEST 2007


On Thu, May 24, 2007 at 11:21:27AM +0200, Zdenek Wagner wrote:
> 2007/5/24, Oliver Bandel <oliver at first.in-berlin.de>:
> >On Wed, May 23, 2007 at 07:23:36PM +0200, Hans Hagen wrote:
> >> David Kastrup wrote:
> >> >"George N. White III" <gnwiii at gmail.com> writes:
> >[...]
> 
> >
> >And btw. it's also possible to create filenames that have spaces
> >on the command line.
> >The problem is, that most (all?) shells doesn't handle them correctly.
> >
> >So, we need to invent at least one shell, that does not have a problem
> >with such names.
> >
> The problem is that the special characters have to be re-escaped if
> the parameter is sent to some other program. Imagine a simple (somehow
> foolish) script:

Yes, and this is annoying.

> 
> #!/bin/bash
> echo "Number of parameters = $#"
> if [ $# -eq 1 ]
> then
>  ./param $1
> fi

If you have "./param", then this might work in some way ;-)


> 
> If you call it with an escaped space within the first parameter, you'll get:
> 
> [wagner at cluster1 wagner]$ ./param some\ text
> Number of parameters = 1
> Number of parameters = 2
> 
> Beware! If you call this script with one parameter, you will fall into
> an endless loop!


"find" has an option "-print0" to end strings with a \0
and "grep" has an option "-Z" or "--null" to look for
strings with such a delimiter.

This makes life much easier, and the quoting-theater can be avoided.

Or when you use the system-near functions (Unix-API) of
C or use aequivalent functions of a scripting language
or programming language, then you will get a char*
or a string type, and the problem of spaces and needed
quotings is gone.

So, shells are not really good in this respect.

Ciao,
   Oliver


More information about the tex-live mailing list