shell script + php

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I'm writing a shell script and inside of it I have variable that I
want to pass to php, but for some reason it isn't working... can
someone help me? here is example



php -r 'geoip_country_name_by_name($i);'

echo $?

php part works in shell if i use actual value from variable and not
variable itself

Re: shell script + php

alexus escribió:
Quoted text here. Click to load it

In bash, single quotes mean "do not parse variables". Try double quotes.
Also, PHP require quotes around strings.

-- - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web:
-- Mi web de humor al baño María:

Re: shell script + php

=C3=81lvaro G. Vicario wrote:
Quoted text here. Click to load it

Alternatively tell PHP where to find the variable:

php -r 'geoip_country_name_by_name($_ENV['i']);'


Re: shell script + php

On Jul 25, 3:25=A0am, "=C1lvaro G. Vicario"
Quoted text here. Click to load it

thanks! that worked!

Site Timeline