3

I have written simple PHP programs meant for the command line that run a script to completion with the hashbang at the top:

#!/usr/bin/php -q
<?php //etc

However I need to write a script that

  • Tells the user they need to create a file named config.xml if it's not there and give a prompt to Continue? Y N
  • If the file is there, then edit it
  • Either way, the program fires off nano
  • On exit from nano the program continues to execute

It is the interactive part that I have never done before, as well as sending to/exiting from another process (nano). How do I make a script interactive and then get the result from another program?

0

Based on: https://stackoverflow.com/questions/3614715/open-vim-from-php-cli

Try with:

<?php 
system("vi config.xml > `tty`");
?>

And modify it in order to be executed under your prompt options.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.