Emulating Shell Functions in Perl

PERL SHELL SCRIPTS

Article from Issue 52/2005
Author(s):

Perl gives you better shell scripts. Sysadm::Install, a new module from CPAN, helps shell addicts let go of Bash.

System administration shell scripts are easily put together using just a few shell commands. An installation routine might use cp, mv, and chmod; a query script might depend upon grep, awk, or sed. If you need more, however, a shell script can start to become complex, or even ugly; and more times than not, you come to a dead end. The shell takes a very roundabout route to get to some places, and there are other places a shell script just can’t go. Creative programmers will always find an (admittedly obscure) way to work around the obstacles, and shells such as Bash, Ksh, and Tcsh have many features found in genuine programming languages. Also, if you prefer to avoid typing, standard Perl is not recommended for simple shell tasks. After all, who wants to have to enter something like the following:

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Perl: Testing Modules with Docker

    If you want to distribute your programs across multiple platforms, you need to prepare them to run in foreign environments from the start. Linux container technology and the resource-conserving Docker project let you test your own Perl modules on several Linux distributions in one fell swoop.

  • Perl: Clonezilla Backups

    Clonezilla makes backing up and restoring your system an easy affair that only involves a few key strokes. A homegrown solution reduces the time and effort to the act of slotting in a CD, on which you previously burned a Perl script.

  • Perl: Network Backup

    Armed with just a rescue CD and a Perl script, you can back up a client’s hard disk across the wire.

  • Perl: noworries

    We'll show you how you can avoid the tragedy of lost files with a transparent, Perl-based version control system.

  • Perl: Tmux Configuration

    Instead of manually rearranging windows in a development environment time and time again, the Tmux terminal multiplexer can restore them from a configuration script.

comments powered by Disqus

Direct Download

Read full article as PDF:

Perl_Shell_Scripts.pdf (370.56 kB)

News

njobs Europe
What:
Where:
Country:
Njobs Netherlands Njobs Deutschland Njobs United Kingdom Njobs Italia Njobs France Njobs Espana Njobs Poland
Njobs Austria Njobs Denmark Njobs Belgium Njobs Czech Republic Njobs Mexico Njobs India Njobs Colombia