On Tue, 2010-06-01 14:31:33 +0200, Michael Westermann <[email protected]> 
wrote:
> > On Mon, 2010-05-31 17:55:26 +0100, A. Dreyer (LUG-OWL) 
> > <[email protected]> wrote:
> > > On 31/05/10 16:34, Jan-Benedict Glaw wrote:
> > > > Input:
> > > >         asdf, "Foo this is", NULL, 17.3
> > > > 
> > > > Output soll sein, daß
> > > > 
> > > >         $1 = adsf,
> > > >         $2 = Foo this is,
> > > >         $3 = NULL,
> > > >         $4 = 17.3
> > > > 
> > > > ist. Klappt auch, solange man
> > > > 
> > > >         set asdf, "Foo this is", NULL, 17.3
> > > > 
> > > > macht, scheint aber fehlzuschlagen, wenn der Text aus einer Variablen
> > > > kommt:
> > > > 
> > > > #!/usr/bin/env sh
> > > > echo ${BASH_VERSION}
> > > > set foo "bar baz" stuff
> > > > echo "1: $1    2: $2   3: $3"
> > > > X='foo "bar baz" stuff'
> > > > set $X
> > > > echo "1: $1    2: $2   3: $3"
> > > > set `echo $X`
> > > > echo "1: $1    2: $2   3: $3"
> > > > 
> > > > 
> > > > Das ergibt dann:
> > > > 
> > > > 3.1.17(1)-release
> > > > 1: foo    2: bar baz   3: stuff
> > > > 1: foo    2: "bar   3: baz"
> > > > 1: foo    2: "bar   3: baz"
> > > > 
> > > > 
> > > > Erwartet hätte ich in allen drei Fällen das Ergebnis der ersten Zeile.
> > > > Die Ergebnisse der zweiten und dritten Zeile halte ich für falsch.
[...]
> schreib doch mal
> 
> eval set $X

Naja...  Das würde ein spezielles Problem lösen, aber das würde dazu
führen, daß das, was in $X ist, ausgeführt werden könnte. Keine
berauschende Idee, wenn da ggf. Texte, die jemand anders
implementiert, aufmal *ausgeführt* werden :)

Oder andersherum: Ich trau' mir keine hinreichend gute
Input-Validierung zu, sodaß der `eval' soweit entschärft werden kann,
daß er nicht mehr "evil" ist...

MfG, JBG

-- 
      Jan-Benedict Glaw      [email protected]              +49-172-7608481
Signature of:            http://www.chiark.greenend.org.uk/~sgtatham/bugs.html
the second  :

Attachment: signature.asc
Description: Digital signature

--
Linux mailing list [email protected]
subscribe/unsubscribe: http://lug-owl.de/mailman/listinfo/linux
Hinweise zur Nutzung: http://www.lug-owl.de/Mailingliste/hints.epo

Antwort per Email an