Scripts

Matthew Seaman m.seaman at infracaninophile.co.uk
Mon Feb 16 08:59:23 PST 2004


On Mon, Feb 16, 2004 at 11:40:56AM -0500, Eric Toll wrote:

> I'm trying to feed a text file into a script.
> Script is suppose to take relevant parts and output them to a new
> file...
>  
> Script is marked executable...
>  
>  
> less textfile | script.pl

Usually you would do that by:

    % script.pl < textfile

People often abuse cat(1) in this sort of case: it's the first time
I've seen anyone do it with less.
  
> script.pl: Command not found.
>  
> What gives??

This typically means that the #! line in the script is incorrect --
for a perl script you need:

    #!/usr/bin/perl

as the first line -- possibly with some extra flags.  This assumes you
actually have perl installed.  perl-5.005.03 comes with the base
system in 4.x, but in 5.x you have to install one of the perl ports --
perl-5.8.2 is now the default perl under 5.2 or above.  In any case,
remember to run the 'use.perl' script after installing or before
de-installing a perl port.

Nb. There are all sorts of weird ways of setting up the #! line of a
perl script floating around the perl community, but those really are a
waste of time on FreeBSD (or most modern unices for that matter).
Stick with the tried and true simple way unless you have an overriding
reason to do otherwise.

	Cheers,

	Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey         Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20040216/224335b1/attachment.bin


More information about the freebsd-questions mailing list