Subject: Re: Re: [ast-users] how to identify a login shell, preferably portably
--------

> By definition, a login shell has "-" as the first character of $0. The
> following test should work for both ksh and bash:
> 
>   if [[ $0 == -* ]]; then echo "This is a login shell"; fi
> 
> --
> Ron Isaacson
> Morgan Stanley
> [EMAIL PROTECTED] / (212) 276-1144
> _______________________________________________
> 

A login shell has a "-" as the first character of the basename of $0 so
that
  if [[ ${0**/} == -* ]]; then echo "This is a login shell"; fi
would be better.  However, login programs typically only use the
basename as argv[0] so this distinction is usually unnecessary.

David Korn
[EMAIL PROTECTED]
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to