LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   bash result to PHP (https://www.linuxquestions.org/questions/programming-9/bash-result-to-php-726842/)

eco 05-18-2009 01:53 PM

bash result to PHP
 
Hi all,

I was wondering if any of you had an idea on how to do the following:

Code:

for i in `whatever the result is`; do
  php thePhpScript.php $i
done

so what I am trying to do is send the result of the for loop as a variable (equivalent to $1 in bash) to my PHP program.

Can this be done?

colucix 05-18-2009 02:47 PM

In a PHP script the first argument is
Code:

$argv[1]
whereas $argv[0] is the name of the script itself.

eco 05-18-2009 03:33 PM

Fab, seems to get the bash variable... now I can have fun trying to use it properly ;)

Thanks mucho!

ghostdog74 05-18-2009 06:50 PM

why not gather everything into a variable, then pass to php once...?
Code:

php phpscript.php $whatever


All times are GMT -5. The time now is 04:04 PM.