Shell scripting VS perl

This is a discussion on Shell scripting VS perl within the Linux General forums, part of the Linux Forums category; Hi. Are there any guidelines to which (automation) problems that should be solved using shell (bash) scripts and which problems ...


Go Back   Usenet Forums > Linux Forums > Linux General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-30-2008
kenneho
 
Posts: n/a
Default Shell scripting VS perl

Hi.


Are there any guidelines to which (automation) problems that should be
solved using shell (bash) scripts and which problems one should solve
with perl?


Regards,
kenneho
Reply With Quote
  #2 (permalink)  
Old 04-30-2008
Dances With Crows
 
Posts: n/a
Default Re: Shell scripting VS perl

kenneho staggered into the Black Sun and said:
> Are there any guidelines to which automation problems should be solved
> using shell scripts, and which problems should [be] [solved] with
> perl?


If it has to be run before /usr is mounted, use shell. If it mostly
involves invoking external programs, or you can do it in less than 40
lines, use shell. If it'd be a complete pain to do it in shell, use
Perl. If none of these things apply, then use whatever you want, just
take care to put in comments and document the script so that you don't
say, "What was I thinking?" 6 months later.

There are not huge numbers of guidelines for this sort of thing because
the number of problems out there is so large, and everyone's approach to
those problems is different. The previous paragraph worked for me.
YMMV.

--
"Cheer up, things could be worse." So I cheered up, and sure enough,
things got worse.
My blog and resume: http://crow202.dyndns.org:8080/wordpress/
Matt G|There is no Darkness in Eternity/But only Light too dim for us to see
Reply With Quote
  #3 (permalink)  
Old 04-30-2008
Ruben
 
Posts: n/a
Default Re: Shell scripting VS perl

On Wed, 30 Apr 2008 03:01:52 -0700, kenneho wrote:

> Hi.
>
>
> Are there any guidelines to which (automation) problems that should be
> solved using shell (bash) scripts and which problems one should solve
> with perl?
>

You can't use Perl on a system job if it's not available while booting.
like prior to when the ram disk is detatched and the drives installed.

Ruben

>
> Regards,
> kenneho


--
http://www.mrbrklyn.com - Interesting Stuff
http://www.nylxs.com - Leadership Development in Free Software

So many immigrant groups have swept through our town that Brooklyn, like Atlantis, reaches mythological proportions in the mind of the world - RI Safir 1998

http://fairuse.nylxs.com DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002

"Yeah - I write Free Software...so SUE ME"

"The tremendous problem we face is that we are becoming sharecroppers to our own cultural heritage -- we need the ability to participate in our own society."

"> I'm an engineer. I choose the best tool for the job, politics be damned.<
You must be a stupid engineer then, because politcs and technology have been attached at the hip since the 1st dynasty in Ancient Egypt. I guess you missed that one."

© Copyright for the Digital Millennium

Reply With Quote
  #4 (permalink)  
Old 05-01-2008
Florian Diesch
 
Posts: n/a
Default Re: Shell scripting VS perl

kenneho <kenneho.ndu@gmail.com> wrote:

> Are there any guidelines to which (automation) problems that should be
> solved using shell (bash) scripts and which problems one should solve
> with perl?


No. If both is possible it's a matter of taste which one you
choose. Some people may even choose something different instead of
Perl.


Florian
--
<http://www.florian-diesch.de/>
-----------------------------------------------------------------------
** Hi! I'm a signature virus! Copy me into your signature, please! **
-----------------------------------------------------------------------
Reply With Quote
  #5 (permalink)  
Old 05-01-2008
s. keeling
 
Posts: n/a
Default Re: Shell scripting VS perl

Dances With Crows <danceswithcrows@usa.net>:
> kenneho staggered into the Black Sun and said:
> > Are there any guidelines to which automation problems should be solved
> > using shell scripts, and which problems should [be] [solved] with
> > perl?

>
> If it has to be run before /usr is mounted, use shell. If it mostly
> involves invoking external programs, or you can do it in less than 40
> lines, use shell. If it'd be a complete pain to do it in shell, use
> Perl. If none of these things apply, then use whatever you want, just
> take care to put in comments and document the script so that you don't
> say, "What was I thinking?" 6 months later.
>
> There are not huge numbers of guidelines for this sort of thing because
> the number of problems out there is so large, and everyone's approach to
> those problems is different. The previous paragraph worked for me.


Good advice. Add that some things are simple in shell and some things
are really difficult, but simple in perl/python/...

The job of a maintenance programmer (inheriting others' code) is an
interesting art. "Where do I even start to fix this?" :-) Please,
at least comment. Document it too, would be nice, but I'll do that if
I have to when you don't. Somebody has to.


--
Any technology distinguishable from magic is insufficiently advanced.
(*) http://blinkynet.net/comp/uip5.html Linux Counter #80292
- - http://www.faqs.org/rfcs/rfc1855.html Please, don't Cc: me.
Reply With Quote
  #6 (permalink)  
Old 05-01-2008
Andrew Halliwell
 
Posts: n/a
Default Re: Shell scripting VS perl

Florian Diesch <diesch@spamfence.net> wrote:
> kenneho <kenneho.ndu@gmail.com> wrote:
>
>> Are there any guidelines to which (automation) problems that should be
>> solved using shell (bash) scripts and which problems one should solve
>> with perl?

>
> No. If both is possible it's a matter of taste which one you
> choose. Some people may even choose something different instead of
> Perl.


Quite, I've dabbled in perl and dabbled a bit more in python...
Must say, by far, python is much more user/programmer-friendly.
Even if you do write your perl in longhand (so to speak) so that it's easier
to understand, it can still be awkward after 6 months to instantly know
what's going on.

There're still somethings, such as text processing, that perl beats python
of course. As there're some things like object oriented structured
programming that python beats perl at.
--
| spike1@freenet.co.uk | "I'm alive!!! I can touch! I can taste! |
| Andrew Halliwell BSc | I can SMELL!!! KRYTEN!!! Unpack Rachel and |
| in | get out the puncture repair kit!" |
| Computer Science | Arnold Judas Rimmer- Red Dwarf |
Reply With Quote
  #7 (permalink)  
Old 05-01-2008
Ignoramus3962
 
Posts: n/a
Default Re: Shell scripting VS perl

When in doubt, use perl. That's true because a lot of scripts tend to
grow beyond their original use. It is easier to write a large program
in perl, especially if it does anything complicated.

I have 174 personal perl scripts. (not counting my other projects such
as my websites, work etc).

i
Reply With Quote
  #8 (permalink)  
Old 05-03-2008
Florian Diesch
 
Posts: n/a
Default Re: Shell scripting VS perl

Andrew Halliwell <spike1@ponder.sky.com> wrote:

> Florian Diesch <diesch@spamfence.net> wrote:
>> kenneho <kenneho.ndu@gmail.com> wrote:
>>
>>> Are there any guidelines to which (automation) problems that should be
>>> solved using shell (bash) scripts and which problems one should solve
>>> with perl?

>>
>> No. If both is possible it's a matter of taste which one you
>> choose. Some people may even choose something different instead of
>> Perl.

>
> Quite, I've dabbled in perl and dabbled a bit more in python...
> Must say, by far, python is much more user/programmer-friendly.
> Even if you do write your perl in longhand (so to speak) so that it's easier
> to understand, it can still be awkward after 6 months to instantly know
> what's going on.


That can be done with python, too.

> There're still somethings, such as text processing, that perl beats python
> of course. As there're some things like object oriented structured
> programming that python beats perl at.


Perl is a really great extraction and report language. But its OOP
support is rather entertaining than really useful for bigger
projects. And complex data structures tend to get confusing in Perl.


Florian
--
<http://www.florian-diesch.de/>
-----------------------------------------------------------------------
** Hi! I'm a signature virus! Copy me into your signature, please! **
-----------------------------------------------------------------------
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 06:59 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0