Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Feb 2004 16:59:17 +0000
From:      Matthew Seaman <m.seaman@infracaninophile.co.uk>
To:        Eric Toll <etoll@vipstructures.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Scripts
Message-ID:  <20040216165917.GA90010@happy-idiot-talk.infracaninophile.co.uk>
In-Reply-To: <9BC86C67C3AF7646B9C5382020457A940136C5@VIP10-WIN2K>
References:  <9BC86C67C3AF7646B9C5382020457A940136C5@VIP10-WIN2K>

next in thread | previous in thread | raw e-mail | index | archive | help

--Q68bSM7Ycu6FN28Q
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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...
> =20
> Script is marked executable...
> =20
> =20
> 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.
 =20
> script.pl: Command not found.
> =20
> 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

--=20
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

--Q68bSM7Ycu6FN28Q
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (FreeBSD)

iD8DBQFAMPbldtESqEQa7a0RAiV5AJ0R18UgjyKk9UNoIkKC8kPHwdVBvgCfXcAx
0PA3VSSfCyE4z3fDCw1ogNk=
=mP4G
-----END PGP SIGNATURE-----

--Q68bSM7Ycu6FN28Q--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040216165917.GA90010>