Hi...
I want to use the multiple interpreter (like #!/bin/bash and #!/usr/bin/php) in a single shellscript. Is it Possible?

I'm afraid you cannot do that in the same script because the shebang needs to be in the first line, but you can separate them:

#!/bin/bash
a=$1
echo "hello $a from bash "
./script.php $a

and inside script.php

#!/usr/bin/php
<?php
$a = $argv;
echo "and hello $a[1] from php\n";
?>

in order to work script.php needs to be executive, otherwise just change the first script to php script.php.

At the end just run ./test gurusubramaniam and you will get:

hello gurusubramaniam from bash 
and hello gurusubramaniam from php

As alternative you can rearrange the bash script to be included in the PHP one:

#!/usr/bin/php
<?php
$a = $argv;
system('echo "hello '.$a[1].' from bash"');
echo "hello $a[1] from php\n";
?>

bye!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.