Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    I need to edit a bash script from a PHP script


    I have a bash script that I want to edit it on a webpage on a raspberry Pi. Here is the script

    HTML Code:
    #!/bin/bash
    linphonecsh init
    sleep 6
    linphonecsh register --host 10.1.10.250 --username 9999  --password abc1234
    linphonecsh status register
    linphonecsh generic 'autoanswer enable'
    linphonecsh soundcard ring 0
    linphonecsh soundcard playback 0
    linphonecsh soundcard capture 2
    linphonecsh generic 'codec enable 8'
    I want to be able to change the host, username and password along with Commenting out the "autoanswer" line. I want to keep this as simple as possible using a web page. How can I do this??

    Thanks

  2. #2
    Super Moderator Roxoff's Avatar
    Join Date
    Aug 2005
    Location
    Nottingham, England
    Posts
    4,039
    I'd use PHP to put these values into variables and write them to a file. Then I'd modify the bash script to read the file and obey the variables.

    I wouldn't have a web page update an executable script on my computer, that's just asking for trouble.
    Linux user #126863 - see http://linuxcounter.net/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •