From owner-freebsd-questions Tue Sep 3 7:16:35 2002 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 6245C37B400 for ; Tue, 3 Sep 2002 07:16:33 -0700 (PDT) Received: from mailsrv.otenet.gr (mailsrv.otenet.gr [195.170.0.5]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7299943E42 for ; Tue, 3 Sep 2002 07:16:32 -0700 (PDT) (envelope-from keramida@ceid.upatras.gr) Received: from hades.hell.gr (patr530-a169.otenet.gr [212.205.215.169]) by mailsrv.otenet.gr (8.12.4/8.12.4) with ESMTP id g83EFwtG027480; Tue, 3 Sep 2002 17:16:17 +0300 (EEST) Received: from hades.hell.gr (hades [127.0.0.1]) by hades.hell.gr (8.12.6/8.12.6) with ESMTP id g83EFqKN053709; Tue, 3 Sep 2002 17:15:53 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Received: (from charon@localhost) by hades.hell.gr (8.12.6/8.12.6/Submit) id g83ED2et053353; Tue, 3 Sep 2002 17:13:02 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Date: Tue, 3 Sep 2002 17:13:02 +0300 From: Giorgos Keramidas To: Kirk Bailey Cc: "freebsd-questions@freebsd.org" Subject: Re: sh script question Message-ID: <20020903141301.GN17303@hades.hell.gr> References: <3D743DFF.B1DE6C8A@netzero.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3D743DFF.B1DE6C8A@netzero.net> Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 2002-09-03 00:43 +0000, Kirk Bailey wrote: > I want to write a script to install a python application. I has to locate the > interpreter, extract that path, and create the shebang declaration on the first > line, then append the remaining prepared script to that ... You don't need to do all that to 'detect' where python is. The python documentation at www.python.org suggests using the following for your own scripts: : $ ls -l koko.py : -rwxrwxr-x 1 charon charon - 44 Sep 3 17:11 koko.py* : $ cat koko.py : #!/usr/bin/env python : : print "Hey, there!"; : $ ./koko.py : Hey, there! This way, env(1) is the intepreter, and python will be searched in the PATH the usual way. Then it won't matter if it's /usr/bin/python, /usr/local/bin/python, or even /opt/python/bin/python, as long as the proper directory is part of PATH. -- FreeBSD: The Power to Serve -- http://www.FreeBSD.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message