Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Aug 2000 06:45:05 -0700 (PDT)
From:      Dima Dorfman <dima@unixfreak.org>
To:        Claude Cormier <techsupport@devises-or.com>
Cc:        dima@unixfreak.org, freebsd-questions@FreeBSD.ORG
Subject:   Re: Newbie need help to execute a shell script
Message-ID:  <20000828134505.EBA6F1F17@static.unixfreak.org>
In-Reply-To: <39AA6722.B97AA3DC@devises-or.com> from Claude Cormier at "Aug 28, 2000 09:20:34 am"

next in thread | previous in thread | raw e-mail | index | archive | help
> Thanks Dima for answering...but it is getting weird.. I had tried of
> course your suggestion which is to include #!/bin/sh as the firs line
> and it didn't work..that is why I asked the question to the list.
> 
> But I tried also adding [START]...[END] in my script like you did...
> even if I was sure that you put only to delemit the script... and here
> is what my shell answers:
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> : not found
> Date and time is:
> [END]: not found
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> So it looks like the shell is  now finding my command but is having a
> problem with the first line..I would have expected to received "[START]:
> not found" as the first line. What is strange is that if I remove the
> 1st and last line in the script {START] and [END]... I get again the
> message "command not found". ANy idea what is wrong with that shell?

Is it possible that the "command not found" (is this the exact
message, anyway?) is caused by an attempt to call a command from
within the script?

Also, try running this script and see if it yields the same results:

	#!/bin/sh
	echo "This is a test."
	exit 0

If the above script doesn't work, then there might be something wrong
with your system.

Some other things you may want to check:
  * Is the script executable? (try `chmod 755 <name>` if you're not sure)
  * Try to run the script like, `sh <name>` to make sure it works.

If none of those work, then I don't know what's wrong.  Maybe
someobody else on the list will.

Hope this helps

Dima

> 
> CLaude
> 
> Dima Dorfman wrote:
> > 
> > > 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 "Date and time is:"
> > > echo "Date and time is:"
> > >
> > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > >
> > > 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`"
> > <the rest>
> > [END]
> > 
> > Change ``/bin/sh'' to whatever shell you want it to be run with.
> > 
> > Hope this helps
> > 
> > --
> > Dima Dorfman <dima@unixfreak.org>
> > Finger dima@unixfreak.org for my public PGP key.
> > 
> > "A problem well stated is a problem half solved."
> >         -- Charles F. Kettering
> 


-- 
Dima Dorfman <dima@unixfreak.org>
Finger dima@unixfreak.org for my public PGP key.

"It's been said that there is no problem that cannot be solved by a
suitable application of high explosives.  Now if I can only figure out
how to send them via e-mail ..."
	-- Vince Sabio


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




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