4

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

1 Answer 1

1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .