Loading ...
Sorry, an error occurred while loading the content.

Re: how to get a shell name?

Expand Messages
  • Damien Carbery
    ... environment variable. ... points to tcsh. ... It is similar when you su , $ENV{ LOGIN } (note the quotes) still holds the original username, but id will
    Message 1 of 4 , May 29, 2003
    • 0 Attachment
      --- In perl-beginner@yahoogroups.com, RK Man <i_am_in_bay@y...> wrote:
      > may be a UNIX question. Anyways,
      > shell_name = $ENV{SHELL}
      > will give the shell name which is being pointed by SHELL
      environment variable.
      > If I am in tcsh, and type sh to move to sh, my SHELL variable still
      points to tcsh.
      > How to get the actual shell which is being used ?
      > Thanks
      > -Ravi

      It is similar when you 'su', $ENV{'LOGIN'} (note the quotes) still
      holds the original username, but 'id' will return the correct one.

      For the shell you might have to look at process IDs i.e. do a 'ps -
      ef' and look for your process ID (the $$ variable) and then find out
      the process ID of the application that launched you i.e the parent
      PID. Then look up that PID and find the application.
      I suppose there is no guarantee that a shell launched your script.
    Your message has been successfully submitted and would be delivered to recipients shortly.