Integrating bash script into php (page)


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Integrating bash script into php (page)
# 1  
Old 03-02-2011
Error Integrating bash script into php (page)

I have written a bash script...now i need to call the script from php page.

Can you give me an example to demonstrate how it is done?Smilie
# 2  
Old 03-02-2011
system() example
Code:
       <?php
echo '<pre>';

// Outputs all the result of shellcommand "ls", and returns
// the last output line into $last_line. Stores the return value
// of the shell command in $retval.
$last_line = system('ls', $retval);

// Printing additional info
echo '
</pre>
<hr />Last line of the output: ' . $last_line . '
<hr />Return value: ' . $retval;
?>

Moderator's Comments:
Mod Comment Please use code tags instead of fancy formatting

Last edited by pludi; 03-02-2011 at 10:59 AM..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Web Development

Passing variable from PHP to bash script

I am totally new to PHP and I am trying to create a script that will as a user for a hostname and then use the "hostname" variable to generate a report using REST API. I am able to create the html script and php script to GET the "hostname" but I am having trouble passing the hostname variable... (10 Replies)
Discussion started by: kieranfoley
10 Replies

2. Shell Programming and Scripting

Refresh web page in bash script

hello, I am trying to refresh my web page which is created in bash script. I have a HTML page which when press a button calls a bash script. this bash script created the same page with dynamic data. When pressing the button I am calling to a function that set time out of 7 seconds and and after... (1 Reply)
Discussion started by: SH78
1 Replies

3. Programming

Integrating bash shell

Hi folks... I am working on a project where I need to have online bash bash shell integrated in my web page. I am not clear of how to do it. can any one suggest?? The UI needs to be developed in c#. (11 Replies)
Discussion started by: keerthi koneru
11 Replies

4. Shell Programming and Scripting

script for adding page number before page breaks

Hi, If there is an expert that can help: I have many txt files that are produced from pdftotext that include page breaks the page breaks seem to be unix style hex 0C. I want to add page numbers before each page break as in : Page XXXX Regards antman (9 Replies)
Discussion started by: antman
9 Replies

5. Shell Programming and Scripting

Help with integrating shell script with sendmail

Hi friends, I want to converting a task ,of making few words in my task mail bold and underlined sometimes, automated through sendmail. I have never used sendmail/mailx before. What i want is my ouput which looks like below: +++++++++++++++ DETAILS: sqlid:6mbiosdfsdff parsing_schema_name:... (1 Reply)
Discussion started by: kunwar
1 Replies

6. Shell Programming and Scripting

Get checkbox checked value from html page to the bash script

hi i m printing all current running processes into an html page with checkbox for each process , using bash script i want to get(retrive) the value of that checked checkbox to kill the process ,can anybody please helpme out thanks in advance (1 Reply)
Discussion started by: vagga06
1 Replies

7. Programming

Modify php script to allow multiple countdowns within one page.

Hi, I have the following php countdown script that counts down to a date and time. Please see the below example: <SCRIPT language="JavaScript" SRC="countdown.php?timezone=US/Pacific&countto=2011-06-25 00:00:00&do=t&data=Sorry, This Offer Has Expired."></SCRIPT> And countdown.php: ... (1 Reply)
Discussion started by: rocket_dog
1 Replies

8. Shell Programming and Scripting

bash script + php

Hello, I want to move some of my bash scripts to php ( add samba user, add new PC in dhcp and etc. ).With Google, I found some articles for bash and php, but there is only simple examples, nothing for variables. Example: #!/bin/bash status=`/usr/local/etc/rc.d/isc-dhcpd status` ############... (1 Reply)
Discussion started by: mrowcp
1 Replies

9. UNIX for Dummies Questions & Answers

Integrating bash with sql.

Hi Guys, I m just curious to know whether it is possible to store the output of a shell command to a database . My main aim is to use a full capacity of sql language to analyze the output generated by shell script. for example. by storing the 5 instances of of top at different interval we... (6 Replies)
Discussion started by: pinga123
6 Replies

10. Web Development

I can't open my index.php page after insert php code

Hello guys, Does anyone can help me? I've just made my simple index.php without any code, but after insert session code to check if any user is authenticated, my index.php doesn't work anymore. Any fresh eyes could help me to see what and where the code is wrong? <? if... (6 Replies)
Discussion started by: metalfreakbr
6 Replies
Login or Register to Ask a Question