Reply to Re: persistent session with system()?

Your name:

Reply:


Posted by Christoph Burschka on 01/22/07 09:41

Serge Terryn schrieb:
> Gene schreef:
>
>> maybe (i'didn't try it) system('variable="Hello World" && echo
>> $variable');
>>
>> Christoph Burschka napisal(a):
>>
>>> I tried to run several shell commands with system() in the same script,
>>> but noticed that things like variables and current location don't carry
>>> over between them. Essentially, each system() call starts a new thread.
>>>
>>> Is there any way to make this persistent, that is, to have this:
>>>
>>> system("variable='Hello World'");
>>> ...
>>> system('echo $variable');
>>>
>>> print out "Hello World"?
>>>
>>> Preferably short of having to put it all into a single call like this:
>>>
>>> system('variable="Hello World";echo $variable');
>>>
>>>
>>> --
>>> CB
>>
>>
>
> shell :
>
> #!/bin/bash
> var = "Hello World!"
>
> saving as hello.sh
>
> In php
>
> passtru('hello.sh');
>
>
>
Mh. Generating and caching these shell-scripts only to execute them a
single time seems a bit unwieldy. Also, this way I can't execute PHP in
between these shell commands - I'd need to accumulate everything the
shell commands require and then run them all in one go.

--
CB

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация