Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 2 Jul 2006 15:23:50 -0700
From:      "jdow" <jdow@earthlink.net>
To:        <freebsd-questions@freebsd.org>
Subject:   Re: another newbie
Message-ID:  <02fa01c69e26$320063b0$0225a8c0@Wednesday>
References:  <20060702153621.99746.qmail@web39104.mail.mud.yahoo.com> <cb5206420607020952q7304deb6kd362435688f84cae@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
From: "Andrew Pantyukhin" <infofarmer@gmail.com>

> On 7/2/06, Isaac Friedman <yifriedman@yahoo.com> wrote:
>> I am new to UNIX but know the basics of getting
>> around, writing simple shell scripts, etc. Is there
>> any way to use a short perl program as a shell script?
> 
> sat64% cat << __END__ > ./script.pl
> #!/usr/local/bin/perl -w
> print "Hello world!\n";
> __END__
> sat64% chmod a+x ./script.pl
> sat64% ./script.pl

Gee, Andrew, you didn't need to obfuscate it that way. At least
edit out your command prompts before posting it.

Isaac, what he meant is to create a file named "script.pl" containing
the two lines:
===8<--- snip
#!/usr/local/bin/perl -w
print "Hello world!\n";
===8<--- snip

Then change its file mode to allow it to execute with the command:
chmod a+x ./script.pl

Finally execute the command by typing:
./script.pl

The "./" part of the chmod command is not strictly needed. But it
is needed when executing the command from your home directory or
most other directories. Your current directory is not implicitly on
the search path for executable files on most well setup "'ix" systems.

{^_^}   Joanne



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?02fa01c69e26$320063b0$0225a8c0>