Re: Shabang executable path
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" } ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Shabang executable path
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. -- Clint Gilders <[EMAIL PROTECTED]> Director of Technology Services OnlineHobbyist.com, Inc. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Shabang executable path
Jordan Michaels wrote: 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 "[EMAIL PROTECTED]" 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 Ok. I'll see what I can do, with what you explained... ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Shabang executable path
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 "[EMAIL PROTECTED]" 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/ [EMAIL PROTECTED] ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Shabang executable path
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 "[EMAIL PROTECTED]"