LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 01-31-2006, 05:52 AM   #1
stormrider_may
Member
 
Registered: Sep 2005
Distribution: Debian
Posts: 304

Rep: Reputation: 30
Is there something that can transform a program made with php to shell-script?


I would to know if there is a program that can transform a source originally made with php to shell-script?
I think the problem is the html, forms and thinks like this. I almost didn't used javascript, so i think this would not be a problem.
 
Old 01-31-2006, 07:06 AM   #2
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,136

Rep: Reputation: 230Reputation: 230Reputation: 230
Hi

I often write shell scripts, and since i'm confortable with PHP i prefer it to bash and the likes.

On Debian first
apt-get install php4-cli
Note it installs a separate php.ini file you might want to edit.

Then just prefix your scripts with path to php, like e.g.
#!/usr/bin/php
<?php
echo "Hi there";
?>

Make the file executable, and you have a shell script.

Hope this helps,
Guttorm.
 
Old 01-31-2006, 08:56 AM   #3
stormrider_may
Member
 
Registered: Sep 2005
Distribution: Debian
Posts: 304

Original Poster
Rep: Reputation: 30
But, how about forms and thinks like this. Will it appear?
 
Old 01-31-2006, 09:12 AM   #4
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,136

Rep: Reputation: 230Reputation: 230Reputation: 230
When you execute the shell script, it will display HTML, if that's what the program outputs.

Shell scripts are usually not very user interactive - I don't think I understand what you're trying to do. If you need HTML rendering, I dont think there's another way except thru a web-server and using a browser. It would be possible to output the HTML and then get the HTML rendered in a web-broswser, but is that really a shell-script?

If you need a lot of interactivety, you need to rewrite everything that has to do with output and input from the users. I suggest looking into ncurses, http://www.php.net/manual/en/ref.ncurses.php
 
Old 01-31-2006, 10:59 AM   #5
xhi
Senior Member
 
Registered: Mar 2005
Location: USA::Pennsylvania
Distribution: Slackware
Posts: 1,065

Rep: Reputation: 45
you can interact with STDIN like you would a normal file.. somthing like this..
Code:
$input = fread(STDIN, $buffer_size);
as Guttorm said.. you cant render html without a browser.. if this is to be all command line maybe you could use lynx to dispay your html.. or forget the html all together..

http://us3.php.net/features.commandline
and google on php cli
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
a script run through a shell program... okeyla Linux - Newbie 1 09-15-2005 10:06 AM
Communication between shell script and program ZooL Programming 6 08-14-2004 05:44 AM
PHP -- How to execute a shell script from PHP using FTP functions?? zoonalex Programming 3 07-29-2004 11:51 AM
converting shell script to php script ? ibro Linux - General 6 05-24-2004 05:19 AM
run shell script in c program u4u Linux - General 1 02-14-2004 02:48 PM


All times are GMT -5. The time now is 07:15 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration