Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Dec 2005 21:11:07 +0200
From:      Giorgos Keramidas <keramida@ceid.upatras.gr>
To:        Blue Raccoon <blue.raccoon@wanadoo.nl>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Can't run scripts no more: "permission denied"
Message-ID:  <20051201191107.GA64113@flame.pc>
In-Reply-To: <20051201194850.42578863.blue.raccoon@wanadoo.nl>
References:  <20051201173603.3E9EC16A427@hub.freebsd.org> <20051201185956.ee767f97.blue.raccoon@wanadoo.nl> <20051201181512.GA63703@flame.pc> <20051201194850.42578863.blue.raccoon@wanadoo.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2005-12-01 19:48, Blue Raccoon <blue.raccoon@wanadoo.nl> wrote:
> On Thu, 1 Dec 2005 20:15:12 +0200
> Giorgos Keramidas <keramida@ceid.upatras.gr> wrote:
> > When did those scripts run fine?  What did you change since then?
>
> First of all I've been stupid. I used
> # ./ script.name
> when I should have used
> # ./script.name
>
> Apparently, this is what causes the "permission denied".

Correct.

> And I now remembered I started doing it this (wrong) way because I
> could not run the 'sylpheed' script. As a newbie I had doubts... maybe
> there should be a space?...

No.  The strange "./" string before the path of the script is just a way
of telling to your shell that "yes, I really mean that you have to look
for the executable of this program under the current directory".  So,
you shouldn't use a space.

> But the 'sylpheed' script still would not run: "command not
> found". There is only one command in the file (which works fine on the
> command line) and a comment: #!/bin/bash I copied the script from the
> web.

There is no /bin/bash executable in FreeBSD.  This is a false assumption
that Linux users tend to fall for.  If the script doesn't use any
special, bash-specific constructs and it works fine with /bin/sh you can
replace /bin/bash with /bin/sh in that line.

> But apparently the comment is not a comment. When I remove it the
> script works (not from firefox, but that's a different problem).

It's not a comment.  When a script starts with a line of the form:

    #!/some/path/to/an/intepreter/binary

then FreeBSD recognizes this as a special "comment" and it runs the rest
of the script (starting from line 2) as an interpreted script.  The
effect is pretty much the same as typing manually something like:

    /some/path/to/an/intepreter/binary script-file

All these minor details are explained in detail in many books about
using UNIX.  It will help a great deal if you read at least one of the
introductory texts about UNIX.  Since you are apparently new to UNIX,
suggested reading material is:

    "For People New to Both FreeBSD and UNIX"
    http://www.freebsd.org/doc/en_US.ISO8859-1/articles/new-users/

    "FreeBSD Handbook"
    http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/

Other FreeBSD documents, can be found at:

    http://www.FreeBSD.org/docs.html

The Handbook contains a nice bibliography chapter, that will point you
to even more reading material, if you find that you need it :)

- Giorgos




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