From owner-freebsd-questions@FreeBSD.ORG Sun Jul 2 22:54:18 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 956DD16A5FD for ; Sun, 2 Jul 2006 22:54:18 +0000 (UTC) (envelope-from jdow@earthlink.net) Received: from elasmtp-banded.atl.sa.earthlink.net (elasmtp-banded.atl.sa.earthlink.net [209.86.89.70]) by mx1.FreeBSD.org (Postfix) with ESMTP id F25EF44131 for ; Sun, 2 Jul 2006 22:23:53 +0000 (GMT) (envelope-from jdow@earthlink.net) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=sgYiwtSYqcupsRzrJzKfohwBDCCiJLt31gLIWIurpmUMZRUh/FbiL1XKnbu1V/e+; h=Received:Message-ID:From:To:References:Subject:Date:MIME-Version:Content-Type:Content-Transfer-Encoding:X-Priority:X-MSMail-Priority:X-Mailer:X-MimeOLE:X-ELNK-Trace:X-Originating-IP; Received: from [71.116.163.125] (helo=Wednesday) by elasmtp-banded.atl.sa.earthlink.net with asmtp (Exim 4.34) id 1FxAM3-0001dm-3t for freebsd-questions@freebsd.org; Sun, 02 Jul 2006 18:23:51 -0400 Message-ID: <02fa01c69e26$320063b0$0225a8c0@Wednesday> From: "jdow" To: References: <20060702153621.99746.qmail@web39104.mail.mud.yahoo.com> Date: Sun, 2 Jul 2006 15:23:50 -0700 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2869 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 X-ELNK-Trace: bb89ecdb26a8f9f24d2b10475b57112010759b553ffc0bb72172f6bc308f9ebb795b3f24a9f74b7f350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 71.116.163.125 Subject: Re: another newbie X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jul 2006 22:54:18 -0000 From: "Andrew Pantyukhin" > On 7/2/06, Isaac Friedman 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