Hi Mark!
On Sun, 08 Jul 2001, Mark Lo wrote:

> Hi,
> 
>       I would like to know.  Is it possible to use php to exec a bash script
> with variable passing from php to bash.  If so how to do this.
> 
either set them in the environment or pass them as arguments.
but before that you man want to type "man bash" at the prompt to meet a new
friend ;)

proof of concept

[joe.php]
<?php
$var1="hello";
$var2="joe!";

putenv("VAR1=$var1");
system("/home/joe/bin/foo.sh $var2");

[foo.sh]

VAR2=$1 
# or VAR2=${1:-not defined} where $1 means the first positional parameter
# after the script name

echo -e "var1: $VAR1, var2: $var2"


ciao

-- teodor

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to