From owner-freebsd-questions@FreeBSD.ORG Mon Feb 14 19:38:40 2005 Return-Path: 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 D180016A4CE for ; Mon, 14 Feb 2005 19:38:40 +0000 (GMT) Received: from rwcrmhc11.comcast.net (rwcrmhc11.comcast.net [204.127.198.35]) by mx1.FreeBSD.org (Postfix) with ESMTP id B186D43D46 for ; Mon, 14 Feb 2005 19:38:40 +0000 (GMT) (envelope-from fbsd-questions@trini0.org) Received: from hivemind.trini0.org (trini0.org[65.34.205.195]) by comcast.net (rwcrmhc11) with ESMTP id <2005021419384001300f7vghe>; Mon, 14 Feb 2005 19:38:40 +0000 Received: from [192.168.0.16] (gladiator.trini0.org [192.168.0.16]) by hivemind.trini0.org (Postfix) with ESMTP id 803506122; Mon, 14 Feb 2005 14:38:39 -0500 (EST) Message-ID: <4210FE40.4020809@trini0.org> Date: Mon, 14 Feb 2005 14:38:40 -0500 From: Gerard Samuel User-Agent: Mozilla Thunderbird 1.0 (X11/20050122) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Clint Gilders References: <4210E482.4060204@trini0.org> <4210F1D9.4070405@onlinehobbyist.com> In-Reply-To: <4210F1D9.4070405@onlinehobbyist.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit cc: freebsd-questions Subject: Re: Shabang executable path X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Feb 2005 19:38:40 -0000 Clint Gilders wrote: > Gerard Samuel wrote: > >> A bit off topic, but I figure someone in here, may be able to point >> me in the right direction. >> >> !#/path/to/php >> >> Im wondering, if its possible for the /path/to/php can be made dynamic. >> i.e. Have the file still look as if it is a shell script, but >> the path to the executable is determined at run time, >> to make it more portable. > > > Seems to me you could use: > > #!/usr/bin/env php > > Much like people often recommend for perl scripts. Very nice... #!/usr/bin/env php $ ./z.php -foo bar array(3) { [0]=> string(7) "./z.php" [1]=> string(4) "-foo" [2]=> string(3) "bar" }