[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: how to determine the interpreter



On Fri, 2010-11-26 at 11:27 -0500, Stephen Powell wrote:
> If a script wants to know which shell is running it, the
> variable $0 might work.  For example,
> 
>    echo $0 

I tried this... but see what I got:

jmf@squeeje:~$ cat sh.sh 
#!/bin/sh
echo $0

jmf@squeeje:~$ cat bash.bash 
#!/bin/bash
echo $0

jmf@squeeje:~$ 
jmf@squeeje:~$ ./sh.sh
./sh.sh
jmf@squeeje:~$ 
jmf@squeeje:~$ ./bash.bash 
./bash.bash
jmf@squeeje:~$ 


seems that $0 simply contains the program being run and not the
interpreter that is running it...

?

Joao



Reply to: