Re: php variables in a backtick command
| From: | Jonathan Duncan | Date: | Sun, 12 Dec 2004 01:25:33 +0000 |
| Subject: | Re: php variables in a backtick command | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-204077@lists.php.net to get a copy of this message | ||
So I tried it that way and it worked, that is annoying though, having to add
extra lines to the code and assign the contents of one variable to another.
Any way around this?
Jonathan
"Jonathan Duncan" <jonathan@nacnud.com> wrote in message
news:20041212010917.20923.qmail@pb1.pair.com...
>I am trying to run a shell command with backticks. However, I get a parse
>error. Is it because I have an array variable in there?
>
> $result =
> `adduser -l=$dist_id -p=$user['password'] --f="$user['name_first']
> $user['name_last']"`;
>
> Do I need to assign the value to a regular variable before I put it in
> there? Like this?
>
> $pword=$user['password']
> $fname =$user['name_first']
> $lname =$user['name_last']
> $result =
adduser -l=$dist_id -p=$pword --f="$fname
> $lname";
>
> Thanks,
> Jonathan