Stories
Slash Boxes
Comments

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Ovid (2709)

Ovid
  (email not shown publicly)
http://publius-ovidius.livejournal.com/
AOL IM: ovidperl (Add Buddy, Send Message)

Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.

Journal of Ovid (2709)

Thursday January 15, 2004
01:31 PM

Shell Scripts

[ #16844 ]

I've been programming Perl for years, but am pretty much "just a programmer". I don't know much about shell scripts or working directly with the operating system, but recently when Schwern posted a small shell script for building a simple project shell without h2xs, I started playing with it. After it got to 100+ lines, I had a full-blown project building tool that created stub modules, set up tests the way I wanted them, added all of my helper utilities and optionally checked things into CVS.

Then I started converting it to Perl, because no one uses shell scripts anymore, right?

I took it as an article of faith that shell scripts weren't necessary, but I've quickly discovered that, if I am willing to sacrifice portability, shell scripts are shorter and easier than Perl. Now I'm creating them at work for small tasks and, if I knew sed or awk, I could possibly even skip the nasty parts where I fire up a Perl interpreter for heavy data munging. More stuff to learn, more stuff to learn, more stuff to ...

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • I'm not much of a shell programmer, not much of a Perl programmer for that matter, but this seems counter to my experience.

    Whenever I write shell scripts, I always miss the ease of manipulating filenames and dates and times that I get in Perl. While I can see how you can save a few keystrokes performing some tasks in shell over Perl, like copying files and the like, I don't see any big wins in brevity with shell over Perl.

    Also, I believe, although I've not actually checked, that Perl startup is not that

  • shell scripts (Score:4, Informative)

    by gav (2710) on 2004.01.15 15:32 (#27432) Homepage Journal
    I try to limit myself to shell scripts under 10 or so lines. I've found that if I want to do more it's better having it re-written in Perl. Otherwise you end up with big scary shell scripts.
    • 10?!?? If I hit 5 lines, I start looking to Perl. If it's less that 5 lines, I generally try to refine it to the point that it will work as an alias.
      • If you use zsh, you can get quite a lot done in those 5 lines. Of course, it makes obfuscated perl look like a model of sanity.

        -Dom

  • Bourne shell is lovely. However, as someone who has written a lot of shell and Perl over the years, I use shell only for very short scripts indeed -- or when the script must run on a system that may not have Perl installed.

    Many times I've started with a shell script, seen it grow to 50 lines, then 100, then ... only to have to rewrite the damned thing in Perl. I could have saved a lot of time and trouble by writing it in Perl in the first place.

    As for shell being shorter, I've found that not to be the c

    --
    /-\