sh: uvozovky v promenne

Jan Friedel jf at devnull.cz
Thu Aug 8 13:44:43 CEST 2013


On Thu, Aug 08, 2013 at 01:32:51PM +0200, Miroslav Prmek wrote:
> 2013/8/8 Jan Friedel <jf at devnull.cz>
> 
> >
> >
> >         eval(1)?
> >
> >         /h.
> 
> 
> A jak presne bych ho mel pouzit, aby to bylo nerozbitne? Muzes mi to
> ukazat, jak bych ten
> ukazkovy skript mel upravit?
> 
	Snad takhle:

$ cat ./t.sh 
#!/usr/local/bin/bash -x

eval /usr/local/bin/curl -sS -i \
    -H 'Content-Type: application/json' \
    -d '{"neco":"'$1'"}'
$ 
$ ./t.sh parameter-1
+ eval /usr/local/bin/curl -sS -i -H 'Content-Type: application/json' -d '{"neco":"parameter-1"}'
++ /usr/local/bin/curl -sS -i -H Content-Type: application/json -d '{neco:parameter-1}'
./t.sh: line 3: /usr/local/bin/curl: No such file or directory
$ 

	Je mozne, ze bude nutne jeste escapovat uvozovky pro ten eval; s
	JSONem v curl bohuzel nemam zkusenost..

	/h.



More information about the Users-l mailing list