Hello,
I'm currently trying to write a shell script, that accepts data via STDIN during execution. When i try to execute the script, i get the prompts for entering the data, then after they have all been processed, it echo's out the text that was supposed to be executed before the prompts. I was thinking this was a buffering error, but even flush()'ing after every echo/print still results in this problem.
The script is running on php 4.2.1 (CGI) on freebsd 4.5
Here is the script:
#!/usr/local/bin/php -q
<?
$fp=fopen("/dev/stdin", "r");
echo "First Name?\n";
flush();
$fname = fgets($fp,256);
print("Last Name?\n");
flush();
$lname = fgets($fp,256);
Print("Welcome ".$fname." ".$lname.".");
?>
Any help would be appreciated.
Jason Reid
jason@achost.ca