From owner-freebsd-questions Sun Aug 27 23: 2:27 2000 Delivered-To: freebsd-questions@freebsd.org Received: from static.unixfreak.org (static.unixfreak.org [63.198.170.139]) by hub.freebsd.org (Postfix) with ESMTP id 4283237B42C for ; Sun, 27 Aug 2000 23:02:18 -0700 (PDT) Received: by static.unixfreak.org (Postfix, from userid 1000) id 727F01F17; Sun, 27 Aug 2000 23:02:17 -0700 (PDT) Subject: Re: Newbie need help to execute a shell script In-Reply-To: <39A9FBA2.6CE94BED@devises-or.com> from Claude Cormier at "Aug 28, 2000 01:41:54 am" To: Claude Cormier Date: Sun, 27 Aug 2000 23:02:17 -0700 (PDT) Cc: freebsd-questions@FreeBSD.ORG From: Dima Dorfman Reply-To: dima@unixfreak.org X-Mailer: ELM [version 2.4ME+ PL61 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-Id: <20000828060217.727F01F17@static.unixfreak.org> Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > I am trying to execute a small shell script and always received the > "command not found" error. > > This is the "display" shell script: > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > # This script displays the date, time, username and > # current directory. > echo "Date and time is:" > date > echo > echo "Your username is: `whoami` \\n" > echo "Your current directory is: \\c" > pwd > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > I am trying this from a tcsh shell. When I start a Bourne shell and type > the same "display" command, I get "no such file or directory". > > The "display" script is in my path and it has "rwx" permissions. > > I even try ./display while sitting in the directory where the script is, > but to know avail. > > Any suggestions... this is probably very basic... but remember I am a > newbie with Unix. You need to put ``#!/bin/sh'' at the top so the system knows that it's a shell script, and which shell to execute it with. So it'd look something like: [START] #!/bin/sh echo "Date and time: `date`" [END] Change ``/bin/sh'' to whatever shell you want it to be run with. Hope this helps -- Dima Dorfman Finger dima@unixfreak.org for my public PGP key. "A problem well stated is a problem half solved." -- Charles F. Kettering To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message