In Linux, how to find out shell type using Shell script. echo $0- will print shell type through cmd line $SHELL - print Default Shell type.
            Asked
            
        
        
            Active
            
        
            Viewed 172 times
        
    -1
            
            
        - 
                    Isn't `echo $SHELL` what you want? – Maroun Nov 15 '16 at 11:08
- 
                    1$SHELL - will display Default shell.. Im looking when i change shell from bash to ksh or bash to csh.. How do we find shell type using shell script – Name Nov 15 '16 at 11:12
- 
                    1Possible duplicate of [How to determine the current shell I'm working on?](http://stackoverflow.com/questions/3327013/how-to-determine-the-current-shell-im-working-on) – chrk Nov 15 '16 at 11:16
- 
                    im looking through Shell Script.. not through cmd line – Name Nov 15 '16 at 11:21
- 
                    @Name Cool. Choose whichever fits your needs. – chrk Nov 15 '16 at 11:38
- 
                    thank u for solution.. But how we can get using Shell Script ? – Name Nov 16 '16 at 05:06
1 Answers
0
            
            
        You can try the following:
ps -p `ps -o ppid= -p $$` -o comm=
it is a little bit dirty, but it works fine for me.
Explanation: ps -o ppid= -p $$ gives you the parent process id of the current running process (your script e.g.)
ps -p...-o comm= tells you the name of the process passed with -p.
 
    
    
        mirokai
        
- 125
- 7
