Re: bilingual scripts, bash/PHP?
- From: Richard Kettlewell <rjk@xxxxxxxxxxxxxxx>
- Date: Fri, 20 Jan 2012 10:53:56 +0000
Richard Kettlewell <rjk@xxxxxxxxxxxxxxx> writes:
crankypuss <no@xxxxxxxxxxxx> writes:
Okay, a bash script has to start with this:
#!/bin/bash
And a PHP script begins suchly:
#!/usr/bin/php
<?php
// code
?>
The question is, how can one code a script that will run PHP if it's
available and if not fall back to bash?
Possibly easier to do it the other way around (certainly so for me since
I don't speak PHP).
#! /bin/bash
set -e
if type php >/dev/null 2>&1; then
exec php /path/to/php/script
Should be:
exec php /path/to/php/script "$@"
of course, to be fully general.
--
http://www.greenend.org.uk/rjk/
.
- Follow-Ups:
- Re: bilingual scripts, bash/PHP?
- From: crankypuss
- Re: bilingual scripts, bash/PHP?
- References:
- bilingual scripts, bash/PHP?
- From: crankypuss
- Re: bilingual scripts, bash/PHP?
- From: Richard Kettlewell
- bilingual scripts, bash/PHP?
- Prev by Date: Re: bilingual scripts, bash/PHP?
- Next by Date: Re: bilingual scripts, bash/PHP?
- Previous by thread: Re: bilingual scripts, bash/PHP?
- Next by thread: Re: bilingual scripts, bash/PHP?
- Index(es):
Relevant Pages
|