From owner-freebsd-questions@FreeBSD.ORG Mon Feb 14 18:17:14 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 5D13716A4CF for ; Mon, 14 Feb 2005 18:17:14 +0000 (GMT) Received: from birch.viviotech.net (birch.viviotech.net [207.108.53.120]) by mx1.FreeBSD.org (Postfix) with ESMTP id DEA0F43D45 for ; Mon, 14 Feb 2005 18:17:13 +0000 (GMT) (envelope-from jordan@viviotech.net) Received: (qmail 15339 invoked from network); 14 Feb 2005 18:24:56 -0000 Received: from unknown (HELO ?10.0.0.100?) (jordan@viviotech.net@207.108.53.117) by birch.viviotech.net with SMTP; 14 Feb 2005 18:24:56 -0000 Message-ID: <4210ECE3.5060109@viviotech.net> Date: Mon, 14 Feb 2005 10:24:35 -0800 From: Jordan Michaels User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20041217 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Gerard Samuel , freebsd-questions@freebsd.org References: <4210E482.4060204@trini0.org> <4210E7A0.3070301@viviotech.net> <4210E8B1.7020207@trini0.org> In-Reply-To: <4210E8B1.7020207@trini0.org> X-Enigmail-Version: 0.90.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Status: CLEAN X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on birch.viviotech.net X-Spam-Level: X-Spam-Status: No, hits=-4.2 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=2.63 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 18:17:14 -0000 Gerard Samuel wrote: > Jordan Michaels 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. >>> >>> Thanks >>> >>> _______________________________________________ >>> freebsd-questions@freebsd.org mailing list >>> http://lists.freebsd.org/mailman/listinfo/freebsd-questions >>> To unsubscribe, send any mail to >>> "freebsd-questions-unsubscribe@freebsd.org" >>> >>> >> Have you tried it? >> >> # script.sh /path/to/php >> >> ----------script.sh---------- >> #! $1 >> echo "This is a test" >> ----------script.sh---------- >> >> ... or something to that effect. > > > > You've misunderstood, what I'm asking, or Im not understanding your > example. > In your example, the path to php, is still hardcoded. > What Im ulitimately trying to achieve, is a script, > that can determine the path to php, where ever it may be... > Thanks > > Ah, yeah, my example was just a way to pass the path on to the script - not determine the path automatically. If you want to determine the path automatically, the only way I can see that you could do that would be to run two separate scripts (including the method I used above.) Something like this: ----------script_caller.sh---------- $DYNAMICPATH = find / -name php | grep php script.sh $DYNAMICPATH ----------script_caller.sh---------- The idea being that the script_caller.sh file would find the path to php on that system, then pass that path on to the script that will be executing the php commands. Now... don't get me wrong. I'm not an expert script writer or anything. I haven't tested these scripts. However, the logic behind them is still valid, and should work if properly executed. (with the correct shell commands, etc) HTH -- Warm regards, Jordan Michaels Vivio Technologies http://www.viviotech.net/ jordan@viviotech.net