Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2003
    Posts
    4

    Unanswered: How do I find the name of the current shell?

    Hello,
    How to find the name of the current shell that I am working on(Whether it is csh or ksh or bsh)? Are there any specific commands to find out?
    I did a search, but could not find any useful links.

    I did "echo $SHELL", but this always ouputs "/sbin/sh" irrespective of which shell I am using.

    Can anyone help on this?

    Regards,
    Murali.

  2. #2
    Join Date
    Oct 2003
    Posts
    18

    Re: How do I find the name of the current shell?

    SHELL always contain the login shell, if not explicitly set to another value.

    Why do you need to find out the shell? You always have '#!/bin/sh' (or similar) at the top of shell scripts, so in those cases the shell is known.

    /Hacker

  3. #3
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    780

    Re: How do I find the name of the current shell?

    Originally posted by mulla
    Hello,
    How to find the name of the current shell that I am working on(Whether it is csh or ksh or bsh)? Are there any specific commands to find out?
    I did a search, but could not find any useful links.

    I did "echo $SHELL", but this always ouputs "/sbin/sh" irrespective of which shell I am using.

    Can anyone help on this?

    Regards,
    Murali.
    Hi Murali,

    Another form, from prompt, execute echo $0 or ps.

    Gustavo.

  4. #4
    Join Date
    Oct 2003
    Posts
    4
    Thanks Gustavo,
    $0 will do.

  5. #5
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    12
    echo $0 works for bourne and korn shell. It is best to use "ps" and find the latest shell forked.
    Thanks and Regards
    Karthik R

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •