Re: passing variables from php to bash script..

From: Date: Sun, 08 Jul 2001 12:08:28 +0000
Subject: Re: passing variables from php to bash script..
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-56753@lists.php.net to get a copy of this message
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

« previous php.general (#56753) next »