OT: How to embed or call a shell script in an html file?

keith smith klsmith2020 at yahoo.com
Mon Jun 24 07:43:29 MST 2013



About 13 years ago I taught myself PERL using http://www.cgi101.com/  I left PERL for PHP several years later.

When choosing a language you may want to consider several things.

1) Is that language readily available with the major virtual hosting companies like GoDaddy and HostGator.

2) What would you like to do with the language beyond the current project.  If you use WordPress, Joomla, Drupal... or any number of open sources browser based apps that are written in PHP, you may consider PHP over PERL.  If you want to do server automation you may what PERL, or maybe that does not matter much any longer and PHP is just as strong.

PHP is not that hard to learn, nor is MySql.  Google is your friend.

I began to learn PHP by creating a simple connection string, selecting a database and then hard coded queries to Create, Read, Update, Delete, (CRUD) and finally a list.  I expanded from there.  You need to know a little HTML and CCS, which I think you already know.  

The beauty of going this route is you can build browser based apps that will run anyplace there is a browser, that means M$, Linux, ALL smart phones (not just the ones that run your app), AND Apple.

And PHP / MySql is everywhere.  

Throw in a little jQuery and you could create some really awesome apps.

Might open up a whole new world for you.


------------------------

Keith Smith

--- On Sun, 6/23/13, George Toft <george at georgetoft.com> wrote:

From: George Toft <george at georgetoft.com>
Subject: Re: OT: How to embed or call a shell script in an html file?
To: "Main PLUG discussion list" <plug-discuss at lists.phxlinux.org>
Date: Sunday, June 23, 2013, 10:28 PM

Several years ago I did a test: perl versus bash cgi scripts.  perl was 
about 5,000 times faster than bash.

Learning Perl isn't that hard - get "Teach Yourself Perl 5 in 21 Days" 
and you'll be ok.

Regards,

George Toft

On 6/23/2013 7:45 AM, Matt Graham wrote:
> From: joe@
>> Now, my follow-up question is, how can I integrate this shell script
>> into an html file as I hope to be able to use it in a web page?
> This is *not* a good idea.  Creating dynamic web pages with shell can be done,
> but it's not one of the things that shell is designed for/good at.  One way is
> briefly described at http://httpd.apache.org/docs/2.2/howto/ssi.html .  You
> will have an easier time of it if you use something that's designed for
> creating dynamic web pages, like mod_python or CGI-Perl or Ruby on Rails or
> PHP.
>
>> #!/bin/bash - This shell script that I have named "qsearch" now works.
>>
>> while (:) do
>> echo -e "Press S to search >>> \c"; ans=`readin`; echo; case $ans in
>>    [sS]) echo -e "Find what word? \c";read name1
>>          echo -e "and what second word? \c";read name2
>>          fgrep -y "$name1" q-hid | fgrep -y "$name2" > tempz
>>          cls; echo -e "\nSearch word(s): $name1 $name2";
>>          echo "Here are the first 10 results found:"; echo
>>          head -10 tempz; echo;;
>>    [qQ]) cls; echo; exit;;
>>    *) cls; echo "Not a valid option."; echo;; esac done
>> esac
>> done
> How is this working?  If I paste the above into temp.sh and execute it, it
> says "/bin/bash: - : invalid option".  If I fix the interpreter line so it
> says "#!/bin/bash" , it complains that readin and cls are not valid bash
> commands.  If I replace "ans=`readin`" with "read ans" and "cls" with "clear",
> it fails with a syntax error because "esac done" is in there twice.
>

---------------------------------------------------
PLUG-discuss mailing list - PLUG-discuss at lists.phxlinux.org
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.phxlinux.org/pipermail/plug-discuss/attachments/20130624/c0b96f50/attachment.html>


More information about the PLUG-discuss mailing list